Search code examples
htmlimagemarkup

Trivial HTML site not showing an image


This one got me really stumped. I have stripped a problematic website of basically everything, being left with the most trivial barebone site you can imagine:

    <!DOCTYPE html>
    
    <html lang="en">
    
    <head>
        <title>Test site</title>
    </head>
    
    <body>
    
        <img​ src​="http://placekitten.com/200/300" />
    
    </body>
    </html>

...and yet, the img tag doesn't work. I get an empty website - and the W3 validator throws errors like Element img​ not allowed as child of element body in this context. (Suppressing further errors from this subtree.). What am I doing wrong? I have no idea what can be causing issues in a markup that consists of basically no elements other than the img and the ones required.


Solution

  • <!DOCTYPE html>
    <html>
    <body>
    <img src="http://placekitten.com/200/300" alt="W3Schools.com" 
    style="width:104px;height:142px;">
    </body>
    </html>
    

    As mentioned in the comment, there were 2 invisible characters after img and src.

    I used text-compare to figure out this, please refer the attached screenshot.

    enter image description here