TextEdit HTML IMG tag problem

Discussion in 'Mac Basics and Help' started by faktion, May 19, 2016.

Tags:
  1. faktion macrumors newbie

    Joined:
    May 19, 2016
    Location:
    United Kingdom
    #1
    I am having a problem using TextEdit (V1.10) to edit HTML for my website.

    I am writing an HTML index page from scratch using HTML code. All of my text and background colours etc. are working fine. When I add a new IMG tag in this code the images will not display on the webpage when opened in Safari.

    When I open an archive HTML file that I created using Windows 98 Notepad, the associated images display correctly in Safari. When I then edit that archive file and add an exact duplicate line of code below the existing code it will not repeat the same image, even though the code is exactly the same as the archive code. The strange thing is that if I copy and paste the original code, the pasted image code works! Only when I type new code into a file using TextEdit does it not work.

    The image file and HTML file are located in the same folder. The code I enter is: <IMG SRC=“01.jpg">

    TextEdit preferences are set as:

    Format: Plain Text
    Options: Smart copy/paste, smart quotes, smart dashes & text replacement

    When opening a File: Display HTML files as HTML code instead of formatted text

    HTML saving options:
    Document type: HTML 4.01 Strict
    Styling: Embedded CSS
    Encoding: Unicode (UTF-8)
    Preserve White Space is checked
     
  2. richard2 macrumors regular

    richard2

    Joined:
    Oct 21, 2010
    Location:
    England, United Kingdom
    #2
    Examine the first quotation mark in your code — it's stylised! To a HTML parser, a stylised quotation mark isn't a quotation mark at all.

    TextEdit will automatically insert stylised quotation marks if the smart quotes function is enabled. If you wish to write code in TextEdit, then you should ensure that this function is disabled; although, a far better solution would be to switch to a text editor that's designed for editing code, such as Atom.

    By the way, you can check whether your HTML code is valid using the W3C Markup Validator.
     
  3. Erdbeertorte macrumors demi-goddess

    Erdbeertorte

    Joined:
    May 20, 2015
    Location:
    Castle Grayskull, Eternia
    #3

Share This Page