Home > Software engineering >  Why can't I insert HTML images?
Why can't I insert HTML images?

Time:11-03

I am a beginner who is learning HTML recently. I put the same HTML file and image in the same folder as below, but only the image icon is displayed and does not print out. Please help me.

<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-wid">
        <title>Typing Text</title>
        <img src="https://cdn-icons-png.flaticon.com/512/2889/2889312.png" alt= "img" width="1000", height="500">
        <link herf="typr.css" rel="stylesheet">
    </head>
    <body>
        <p id="dynamic" >
             Learn To HTML
             
        </p>
        <p  > LAilac
        </p>
    </body>
</html>

<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-wid">
        <title>Typing Text</title>
        <img src="https://cdn-icons-png.flaticon.com/512/2889/2889312.png" alt= "img" width="1000", height="500">
        <link herf="typr.css" rel="stylesheet">
    </head>
    <body>
        <p id="dynamic" >
             Learn To HTML
             
        </p>
        <p  > LAilac
        </p>
    </body>
</html>

CodePudding user response:

Try this code:

<!DOCTYPE html>
<html lang="ko">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-wid">
        <title>Typing Text</title>
        
        <link herf="typr.css" rel="stylesheet">
    </head>
    <body>
<img src="https://cdn-icons-png.flaticon.com/512/2889/2889312.png" alt= "img" width="1000", height="500">
        <p id="dynamic" >
             Learn To HTML
             
        </p>
        <p  > LAilac
        </p>
    </body>
</html>

The reason is because you didn't move your <img> tag inside the <body> tag.

CodePudding user response:

Move the <img> tag inside the <body> tag. You placed it in the <head> section.

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-wid">
    <title>Typing Text</title>
    
    <link herf="typr.css" rel="stylesheet">
</head>
<body>
    <img src="https://cdn-icons-png.flaticon.com/512/2889/2889312.png" alt= "img" width="1000", height="500">
     <p id="dynamic" >
          Learn To HTML
          
     </p>
     <p  > LAilac
     </p>
</body>
</html>
  •  Tags:  
  • html
  • Related