Correct understanding of Div+css and CSS layout with XHTML tags

Source: Internet
Author: User
Tags define definition
Css|xhtml

DIV+CSS advanced layout has gradually become popular, but in the face of the so-called div+css layout of the people more worried, do not let div become a substitute for table, multi-layer nested div will seriously affect the readability of the code, using HTML to provide us with the tag bar.

When should you use div?

Although there are no hard rules in this regard, the individual believes that Div is more suitable for the general framework of the positioning. For example, we define a section of the head that defines a div like this:

here is what to write in the head frame

Of course, you can use class to define, but generally speaking, if not on the same page will repeat the elements, with the ID can better distinguish.

View the following definition code


<H1 id= "Masthead" >




Defines the top navigation (UL part), the big logo on the left and the no.xxxx of the circle.

He didn't use Div to do the top frame, but it was a good illustration of the purpose of the code, why? Because he used the tags provided by HTML and the definition of the style name

Other most common layout labels

H1
This tag may really go to use very few people, because it shows the font is really too "big", but we are csser, what label style can not be changed? And the meaning it can express is as obvious as it used to be (headline) I think you already know how to use it ^_^

Ul
This label is used to define a lot of the navigation section, of course, can also use OL to replace, but there is no navigation links to the order of the bar, so or with the more accurate UL (remove the CSS after the effect is more obvious)

B
This label, which is no longer recommended for use, has a lot of convenience in the layout (because it's short), although I'm not too in favor of using the tag, but sometimes (like the layout definition of a small place) is a good choice.

H2
H2 use the most places should not be layout, but subtitle, but some places need to define the column style, use this label is more appropriate, column content use P



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.