Correct understanding of DIV + CSS, CSS layout using XHTML labels

Source: Internet
Author: User

The advanced layout of DIV + CSS has gradually become popular, but the so-called DIV + CSS layout makes people more worried. Do not make DIV a substitute for Table, the multi-layer nested DIV will seriously affect the readability of the code. Use the tags provided by HTML.
When should I use DIV?
Although there are no hard rules in this regard, I personally think that DIV is more suitable for positioning the general framework. For example, if we want to define a region of a header, a DIV is usually defined as follows:
<Div id = "header"> the content to be written in the header framework </div>
Of course, you can use class to define it, but generally, if it is not an element that will be repeated on the same page, it can be better differentiated by id.
View the following definition code:

The code is as follows: Copy code
<Ul id = "navbar">
<Li id = "articles">
<A href = "/articles/" title = "Articles"> Articles </a> </li>
<Li id = "topics">
<A href = "/topics/" title = "Topics"> Topics </a> </li>
<Li id = "about">
<A href = "/about/" title = "About"> About </a> </li>
<Li id = "contact">
<A href = "/contact/" title = "Contact"> Contact </a> </li>
<Li id = "contribute">
<A href = "/contribute/" title = "Contribute"> Contribute </a> </li>
<Li id = "feed">
<A href = "/feed/" title = "Feed"> Feed </a> </li>
</Ul>
<H1 id = "masthead">
<A href = "/">

</A>
</H1>
<Div id = "ish">
<A href = "/issues/214" title = "Issue 214"> No. <em> 214 </em> </a>
</Div>

Defines the top navigation (ul part), the big logo on the left and the mark of the round No. xxxx.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.