Home  >  Article  >  Web Front-end  >  div css is a web page layout technique_html/css_WEB-ITnose

div css is a web page layout technique_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 13:05:051130browse

The following are some tips summarized in the work, kept for reference, I hope it will be useful to people who see it~~

1, ul: The default margin and padding of ul are not 0. If a left-floating li is used in navigation, it will often expand the external div, causing the page to deform. Change it to: ul{margin:0px; padding:0px;}

2. img: 1. Among the problems involved in different browsers here, the height of the image displayed in ie6 is always greater than the accurate value. Here we need to remember the following point img{display: block}; 2. It is best not to use large backgrounds on the page, and those that can be tiled should be tiled, otherwise the loading will be very slow, and it will not be conducive to future
optimization and expansion. Of course, there are also some large websites, and now they try to unify the background. Put it on an image and use background-postion to get the background. 3. The best format is the gif format, which ensures that the background is transparent and there will be no shadows in ie6. Sometimes the gif image will be jagged, which requires us to save it in web format, set the matter, and use the background as the value of matter. The closer the color values ​​are, the better.


3. Overflow: Sometimes the registration agreements of some companies are very long, so overflow is used. You can add this to the style of the div: overflow: auto

4. float: Sometimes some divs will be squeezed to the top of the page. This may be caused by floating. You can add clear: both.

5. div: A div with height equal to 1px may not be 1px in IE6. Add font-size: 1px to the style of this div; this will be ok.

6, id and class: When a style is used multiple times on the page, do not use id, use class. When using js, it is best not to use id for the style, because the id should be left to js. use.

7, link: .link: link{}, .link: visited{}, .link:hover{}, .link: active{}. One thing is that the order of visited and hover must not be reversed, otherwise there will be big problems in ie6.

8. CSS encoding problem: @charset "utf-8"; Pay attention to this line of code. UTF-8 and gb2312 are two commonly used encoding methods.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn