Home >Web Front-end >HTML Tutorial >Issues that need attention in div css_html/css_WEB-ITnose
1. Check whether the HTML element has spelling errors and whether the closing tag is forgotten
Even veterans often make mistakes in the nesting relationship of divs. You can use Dreamweaver's verification function to check Check for any errors.
2. Check whether the CSS is correct
Check whether there are any spelling errors, whether you forgot the "}" at the end, etc. You can use CleanCSS to check CSS for spelling errors. CleanCSS is a tool to reduce weight for CSS, but it can also check for spelling errors.
3. Determine the location where the error occurred
If the error affects the overall layout, you can delete the div blocks one by one until the display returns to normal after deleting a div block, then you can determine where the error occurred Location.
4. Use the border attribute to determine the layout characteristics of the error element
Using the float attribute for layout will cause errors if you are not careful. At this time, add the border attribute to the element to determine the element boundary, and the cause of the error will be revealed.
5. The parent element of a float element cannot specify the clear attribute
Under MacIE, if the clear attribute is used on the parent element of a float element, the layout of the surrounding float elements will be confused. This is a famous bug of MacIE. If you don't know it, you will take detours.
6. Float elements must specify the width attribute
Many browsers have bugs when displaying float elements without specified width. So regardless of the content of the float element, the width attribute must be specified for it.
7. Float elements cannot specify attributes such as margin and padding
IE has a bug when displaying float elements with margin and padding specified. Therefore, do not specify margin and padding attributes on float elements (you can nest a div inside the float element to set margin and padding). You can also use hacks to specify extraordinary values for IE.
8. The sum of the widths of float elements must be less than 100%
If the sum of the widths of float elements is exactly 100%, some ancient browsers will not display properly. Therefore, please ensure that the sum of the widths is less than 99%.
9. Whether the default style has been reset
Different browsers will have different interpretations of certain attributes such as margin, padding, etc. Therefore, it is best to set all margin and padding to 0, list style to none, etc. before development.
10. Did you forget to write the DTD?
If the display results of different browsers are still different no matter how you adjust it, then you can check whether you forgot to write the DTD at the beginning of the page.