Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

faktion

macrumors newbie
Original poster
May 19, 2016
1
0
United Kingdom
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
 

richard2

macrumors regular
Oct 21, 2010
236
51
England, United Kingdom
The code I enter is: <IMG SRC=“01.jpg">

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.