Home  >  Article  >  Web Front-end  >  css: Detailed explanation of voice-family attribute

css: Detailed explanation of voice-family attribute

黄舟
黄舟Original
2017-07-17 14:10:382406browse

voice-familyAttribute

#sidebar {
  width: 200px;
  padding: 10px;
  border: 10px solid black;
}

Set the width here to 200px, Padding to 10px, and the border to 10px, but in Window IE5.5 When viewing the page in previous browsers, the width would be 40px less than the actual width (200px-10px-10px-10px-10px), so this needs to be corrected. The "cascading" feature of the style sheet is used here. For the same attribute of the same selector, the value defined later will overwrite the value defined earlier.

The redefined style is:

#sidebar {
padding: 10px;
border: 10px solid black;
width: 240px; 
voice-family: "\"}\"";
voice-family: inherit;
width: 200px; 
}

And "voice-family:"\"}\"" ;voice-family:inherit;" is the voice attribute of CSS, because Window IE5. 5 does not fully support CSS2 and does not recognize this property, so it skips to the next selector.

IE5 cannot correctly read the two paragraphs voice-family: "\"}\""; voice-family:inherit;, so it gives up reading #centercontent before reading the second Width. , and finally only the first width: 240px can be read.

Browsers above IE5.5 get the second width: 200px due to the principle of covering the same name. In this way, two Width values ​​can be defined in the same Class.

The above is the detailed content of css: Detailed explanation of voice-family attribute. For more information, please follow other related articles on the PHP Chinese website!

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