How to choose the HTML tags to use? When to choose which label? How to choose HTML tags in web page layout?
When laying out, you will encounter how to choose the HTML tag layout, but it is very simple for non-novice CSSers, but it is an invisible problem for those who have just learned or just started making CSS.
Here is a brief introduction to how to select HTML tags in DIV CSS layout:
1. Frame layout (using DIV tags)
Generally use DIV for frame layout in web pages Layout, regardless of the size of the DIV box, generally use the DIV tag (
2. List layout (using ul li tag)
When encountering picture lists and article title lists, ul li list tags are usually used for layout. Of course, setting up when using these tags requires CSS styles to achieve layout effects. This makes it easier for the program to do loop content when calling data.
3. Title layout (using h1, h2, h3, h4 tags)
When encountering independent column titles and text tags, usually use h1, h2, h3, h4 title tags. This layout gives the content a sense of hierarchy. At the same time, considering SEO, proper use of these title tags will help optimize rankings.
4. Content independent style (using span)
In a paragraph of text, there are several texts that need to be set with a separate color value. At this time, you can add span tags to these texts. Set a separate class or direct CSS style for the span tag to achieve the effect. Generally speaking, span is rarely used in layout frameworks.
5. Functional layout (img, b, strong, u, s, etc. tags)
Use the Img tag when encountering attractive images on the web page; use the b tag when encountering bold text or strong tag, use u tag when encountering underline, use s tag when encountering text through line (strikethrough), etc. Sometimes CSS is not necessarily used to implement these functional layouts. It is better to use these HTML tags appropriately from the SEO aspect.
6. Paragraph (p tag)
Generally, the p tag is used for paragraphs in articles, that is,
is used at the beginning of each paragraph and
is used at the end, so that the article The paragraphs are clear.7. Manually force line break layout (br tag)
If you encounter text that needs to be wrapped, use the br tag, that is, "
". It is worth noting that the br tag is a separate tag. The box tag is an independent tag. Use the br tag wherever line breaks are needed.
8. Table type (table table tag)
In HTML layout, learning DIV CSS does not mean giving up the table tag. This sometimes still requires the table tag, such as when encountering table type For layout, table tr td tag layout is still needed. At this time, using table layout is better than div tag.
9. Form layout (form, input, etc.)
When encountering form layout, such as registration, login, filling in data and submitting places, etc., all use form tags.
The above is the detailed content of html How to use html tags. For more information, please follow other related articles on the PHP Chinese website!