Css+div page Layout Common errors

Source: Internet
Author: User

Css+div is one of the most commonly used terms in the Web site standard (or "Web Standard"), and body acoustic waves are usually meant to illustrate the difference from the way the table is positioned in the HTML web design language, because the XHTML web Design standard eliminates the use of table positioning techniques and instead uses CSS Div's way to achieve a variety of positioning. It's easy to make some mistakes when applying DIV+CSS encoding. This article lists some common errors:

1. Check HTML element labels for spelling errors, forgetting to end tags

Even a veteran often makes a mistake about the nesting of Div's relationships. You can use the Dreamweaver validation feature to check for errors.

2. Check that the CSS is correct

Check to see if there are any spelling errors, forgetting the end of the}, and so on. Body acoustic waves can use cleancss to check for spelling errors in CSS. CLEANCSS is a tool for CSS weight loss (CSS compression), but can also check for spelling errors.

3. Determine where the error occurred

If the error affects the overall layout, you can delete the DIV block one after the other, until you delete a DIV block and the display returns to normal, to determine where the error occurred.

4. Use the Border property to determine the layout characteristics of an error element

Using the Float property layout is an error when you accidentally make a mistake. Body Acoustic wave At this point, the element is added to the border attribute to determine the element boundary, the error reason is the bottom (also known as floating generation, learn how to clear CSS floating).

5. The parent element of the float element cannot specify the clear property

Macie If the clear attribute is used on the parent element of the float element, the layout of the float element around it is confusing. This is Macie's famous bug, if you don't know it will be a detour.

6. Float element Be sure to specify the Width property

Many browsers have bugs when displaying a float element that does not have a width specified. So regardless of the contents of the float element, be sure to specify the width property for it.

When specifying an element, use EM instead of PX as a unit.

7. Float element cannot specify attributes such as margin and padding

IE has a bug when displaying float elements that specify margin and padding. Body acoustic waves Therefore, do not specify the margin and padding properties on the float element (you can nest a div inside a float element to set margin and padding). You can also use the Hack method to specify an extraordinary value for IE.

8. The sum of the width of the float element is less than 100%

If the width of the float element is exactly 100%, some old browsers will not display properly. So make sure the sum of the widths is less than 99%.

9. Do you want to reset the default style?

Some properties, such as margin, padding, and so on, can be interpreted differently by different browsers. Therefore, it is best to first set all the margin, padding to 0, CSS list style to none, etc. before development.

10. Have you forgotten to write the Dtd-doctype statement?

If no matter how to adjust the different browser display results or not the same, body music relaxation chair then you can check the beginning of the page is not forget to write the following this line DTD:

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >

But now DOCTYPE can be abbreviated as:

<! DOCTYPE html>

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.