Adding pictures reasonably can make a web page more beautiful.
The <img> tag is used to insert pictures into web pages< The img> tag has an important attribute “SRC”, whose attribute value is the address of the image. Here we are at our index Insert a picture into HTML. Open “index HTML “file, add the following code before </body>:
<p><img src=” https://imgs.developpaper.com/imgs/logo.gif “Alt=” technical support “/ ></p>
Browse the web after saving. Please make sure your web page is the same as this page.
We noticed that <img> is an empty tag, and a “/” should be added at the end to meet the requirements of XHTML. In addition to SRC, the example here also has an attribute alt, which we call the replacement attribute. When the image cannot be displayed for some reason, the attribute value of ALT will appear instead of the image; When the picture is displayed normally, you can see the attribute value of the alt attribute as long as you stop the mouse over the picture.
We learned to create hyperlinks in the previous tutorial. Next, we open “index.html” and change the newly inserted code to the following paragraph:
<p><a href=” https://www.jb51.net/ “><img src=” https://imgs.developpaper.com/imgs/logo.gif “Alt=” technical support “/ ></a></p>
Browse the web page after saving. Please make sure your web page is the same as this one again. See if the picture has become a hyperlink. Click on the picture to enter the homepage of rookie bar.
From the beginning of this section, we will not modify the appearance of the web page “index.html”. Now we will send the web page we have made to the authority for inspection. First enter: http://validator.w3.org/ , this page is an XHTML validation tool, which is used to test whether the web pages we make comply with XHTML standards. You can choose to use the website for validation or upload the file for validation. You can select the file upload validation method as follows:
In the “validate by file upload” column, click browse, find and select the previously saved “index.html”, and then click the “check” button. Your results should be the same as those we verified through the website. The following error message is returned:
Sorry, I am unable to validate this document because on line 3, 6-9, 12-14, 16-22 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.
Is our web page not XHTML compliant? Please continue to the next section.