Nicola Daaboul
Nicola Daaboul

Reputation: 77

Why won't my image show in HTML?

I'm having issues with getting an image to display on my HTML page. I currently have "image.png" in the same folder as the .html file and it still won't work. I am using Chrome btw. Here is my code:

<!DOCTYPE html>

    <head>
        <title> Title </title>
    </head>

    <body>
        <h1> This is an image </h1>
        <img src = “image.png” alt = “Image text”/>

    </body>

</html>

Upvotes: 0

Views: 867

Answers (4)

DLMousey
DLMousey

Reputation: 147

Looks like the editor you're using is applying some form of character encoding that's messing with your script, Notice how your quotation marks are slanted? What editor are you using?

The best way to fix this is to either put your code into Notepad (if you're on windows) and retype your quotation marks to remove the character encoding or configure your editor to use the correct encoding (Usually UTF-8)

Upvotes: 0

Kaspar Lee
Kaspar Lee

Reputation: 5596

You seem to be using smart quotes. You need to use normal ones.

Replace with '"' and with "

<img src = "image.png" alt = "Image text"/>

You should use a Programming Editor like Notepad++ or Sublime Text, since they do not convert quotes into smart quotes

Also not that you are missing the opening <html> tag

Upvotes: 1

user3211033
user3211033

Reputation:

Is it in a folder inside the root folder? Also use "".

<img src="image.png" alt="image text" style="width:100px;height:100px;">

Upvotes: 0

Idos
Idos

Reputation: 15310

You should be using standard quotation marks, e.g. " ". So:

<img src = "image.png" alt = "Image text"/>

Upvotes: 0

Related Questions