The doctype Declaration also affects the CSS display effect!

Source: Internet
Author: User

See the following two sections of code:

<HTML>
<Head>
<Style type = "text/CSS">
SPAN, div {
Width: 100px;
Border: 3px outset buttonface;
}
</Style>
</Head>
<Body>
<Span> <div> Hello </div> </span>
<Span> <div> world </div> </span>
</Body>
</Html>

 

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Style type = "text/CSS">
SPAN, div {
Width: 100px;
Border: 3px outset buttonface;
}
</Style>
</Head>
<Body>
<Span> <div> Hello </div> </span>
<Span> <div> world </div> </span>
</Body>
</Html>

The difference between the two code segments is only the doctype declaration, but please check their display effect in IE6. The 1st code segments are all in the same line, while the 2nd code segment produces a line break! In ff, the display effect is another scene ......

I used to think that with CSS, tables can be discarded. But now we find that CSS is also unreliable.
For example, I may write a page component and use CSS to control the layout. But how do I know what kind of doctype the secondary component will be used?
In addition, this doctype is generally not very concerned. I used to do this because I don't know what the difference is.

It seems that it is more appropriate to use tables in some places, and it is more convenient to process them than Div and so on. Without the final unified standards of HTML and CSS, the table can continue to emit its youthful vigor!

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.