Padding and margin can make the appearance of an area display completely the same. So it may make many people think that padding and margin are interchangeable. In fact, they are very different, and you need to carefully consider which one you choose. I think the principle of using padding for containers or using margin for labels in containers is as follows: when hiding the labels in the container or container (a certain part needs to be hidden and displayed frequently in real projects), this will minimize the impact on the overall layout.
For padding, ie6 and ie7 (FF) do not parse the width of the label with the padding style. The label width of ie6 does not contain the values of padding-left and padding-right, while that of ie7 and ff is. For example, if the width of a div is set to 100px and the padding is set to 10px, the width occupied by the div in ie6 is 120px (including 10 padding-left and 10 padding-right ), ie7 and ff occupy a width of PX. Because ie7 and ff will think that 100 already contains 20 px padding.
Min-height and height
If you only need to be compatible with ie6, you do not need to pay attention to the min-height style, because ie6 does not support this style at all. However, when you need to take care of ie7 and ff, you must pay attention to this style. Because many styles with a fixed value of height = are configured in ie6, ie7 and ff do not adapt to the height when the container is held above the height. This leads to layout confusion. To adapt to the height in ie6, ie7, and ff, set min-height and use css Hack to set height. For example:
Example Source Code [www.111cn.net]
Min-height: 600px;
_ Height: 600px;
Advantages of id (Disadvantages of class): id is written in css with "#" selector, and class is written in css with "." selector. "#" The selector has a higher priority ". "selector is about 10 times, so when you need to increase the priority, the id tag, or the tag in the id container will be very easy and effective. But the class label or the class container label may cause the escalation of priority to fail.
Disadvantages of id (Advantages of class): id should be unique, so its reusability is very poor, while class can be reused. Therefore, if a piece of things has multiple pages and even a page is used multiple times, you must use class as the style selector. Id is unique. When the id of a control is uncontrollable, the id selector will lose its meaning, but any control is dynamically generated, its cssClass is still customizable, so when your tag needs to be replaced by a server-side control, and the id of the server-side control is uncertain, use the class selector, in this way, you only need to set the cssClass of the server control as the name of the class selector. (Of course, this requires a lot of experience, and the project will be gradually improved when it is done too much)