Home  >  Article  >  Web Front-end  >  Some small details of css

Some small details of css

高洛峰
高洛峰Original
2016-11-24 10:37:331625browse

1. Hiding elements with visibility will not cause reflow and repaint (reflow and repaint), but display will do the opposite. At the same time, hiding visibility will not cause involvement (that is, when the descendant element is visible, it will not be affected by the parent's hidden);

2. Text-indent will cause additional performance consumption when using negative margins to hide text, and it can only act on block, table cells and inline-block attribute elements. It will also generate a dotted box. You can use font:0/0 ' songti' replacement;

3. When using height:0;overflow:hidden to combine hidden elements, when its child elements contain position:absolute or fixed (the parent element has no position attribute), the hiding will be "invalid" ( That is, the child elements are not affected by cutting. Note: When the width of the parent element is also set to 0, IE6 and 7 will have a strange "bug" hiding the child elements. The reason why I say bug is that I can test it by opening IE debugging at this time. The hidden parent child element appears strangely when the tool is selected. As for the problem, I will reply if you know it);

4. position: absolute, an element that does not apply left/top and other attribute values ​​​​is an ordinary element that does not occupy space, that is, this element You can normally inherit attributes such as text-align from the parent (Note: After inheritance, the alignment is based on its own left side as the baseline. For example, after defining text-align:right, it will align its leftmost side with the rightmost side of the parent. , it’s a bit convoluted and will be clearer after testing it yourself. Example:

);


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