Home  >  Article  >  Web Front-end  >  HTML Beginner's Guide (10)

HTML Beginner's Guide (10)

黄舟
黄舟Original
2016-12-23 14:48:29948browse

Troubleshooting
Avoid overlapping tags
Look at this HTML example:

This is an example of overlapping HTML tags.

overlapping The word is included at the same time In both and tags. The browser won't know what to do in this case, so you may not get the desired effect.

Overlapping tags should generally be avoided. Check your tags, Make them appear in pairs. Tags used in pairs (obviously except for elements where the closing tag can be omitted, such as paragraph tags) should not be interrupted in the middle. Look at the example above again. Before the middle tag (DFN) has not ended , you cannot end with a bold tag . Before you put the file on the server, you should check the following for errors similar to the above.

embed Only Anchors and Character Tags mbed Only Anchors and Character Tags
HTML protocol allows you to embed hyperlinks within other HTML tags:

My heading



Don’t include an anchor chain Embed HTML tags in:


My heading




Although most current browsers can handle the second example , the official specification of HTML does not support this structure, and your file may have problems in future browsers. Remember, a browser can be forgiven for displaying incorrectly encoded files. But this tolerance may It will not be carried over to the next version of the software! When in doubt, write according to the HTML specification (see additional information below). The

character tag can be used in other elements to change the text display mode:



  • An italic list item


Avoid embedding other types of HTML element tags. For example, you might want to Embed the heading font in the list to increase the display of some characters:


  • A large heading


  • Something slightly smaller



Although some browsers can display this encoding well, it is difficult to say whether this format will be valid in the future because it is undefined. To ensure compatibility with all browsers, you should Avoid using this structure. (Netscape supports a tag, which is used to specify the size of a character displayed in the browser, which is not currently defined in the official HTML specification.)

In the
  • tag What is the difference between inserting a tag in
  • Should be related to the content of the current document. Therefore

    has no meaning when it appears in a list.

    Character formatting tags usually cannot be appended. For example, you might want to write like this:

    < I>some text

    Expect a bold italic text. Some browsers do; others only interpret the innermost markup.

    Final Steps
    Make your coding effective
    When you put a document into a web server, make sure the format and every link is correct (including named anchors). Ideally this is when you think the document is complete Let others browse and leave comments.

    You can use the HTML Validation Service to verify that your document conforms to currently accepted HTML standards. If you don't know whether your document conforms to HTML specifications, this service is a Useful teaching tool. This service allows you to select a validation level (eg, strict, level 2, level 3). If you want to use some non-standard format, this Free is useful.

    Alternate Images
    When the image pointed to by the tag does not exist, your browser will use an alternative image. If this happens when you last check your file, You should make sure that the image file you are pointing to actually exists, that the URL information used by the hyperlink is correct, and that the file attributes are set correctly (readable by everyone). Then check again!

    Update your files
    If the content of a file is Static content (such as George Washington's biography), may not need to be updated. But for content that is time-sensitive, or contains areas that change frequently, remember to keep updating your files!

    Updates are important when files contain information such as weekly schedules or deadlines for events. Delete outdated files or note why some outdated information is still on the server (for example, an event is in the next round) The requirements and current content are the same, so the file will still have reference value after a period of time).

    Differences in browsers
    Different web browsers display different HTML elements. Remember that not all browsers display the same HTML elements. Able to interpret all tag elements in HTML files. However, browsers usually just ignore tags that they don't recognize.

    You may have spent a lot of time making your files "look pretty" in the browser you are currently using. . If you view your document in another browser, it will probably look different, or even very different. So remember this advice: use correct HTML for your document. Leave the interpretation to the browser.

    Comment your files
    You may want to leave some comments in your HTML files. Comments in HTML are similar to comments in computer programs - the text you enter is not used to Readers cannot see them directly if they are displayed by the browser. Just like comments in a computer program are not used by the program itself, program users cannot see these comments. However, if readers look at the original file, they will be able to see them. to comments.

    General comments include the name of the author of the updated file, the software used to generate a file and its version, or some minor change information.

    The format for adding a comment is:



    You must include exclamation points and hyphens.

    Additional information
    This guide is just an introduction to HTML, not an exhaustive reference. Below is some additional reference information. Don't forget to first Go to the nearby bookstore to check out Web and HTML books.

    The above is the content of HTML Beginner’s Guide (10). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


  • Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Previous article:HTML Beginner's Guide (9)Next article:HTML Beginner's Guide (9)