Home >Web Front-end >Front-end Q&A >Are css attributes case sensitive?
CSS properties are not case-sensitive; because in CSS tag selectors and attribute selectors are case-insensitive, but class selectors and ID selectors may be case-sensitive, depending on the document language.
The operating environment of this article: windows7 system, HTML5&&CSS3 version, Dell G3 computer.
Q: Is CSS case-sensitive? (Is CSS case sensitive?)
This question is not that easy to answer.
Some books say that CSS is not case-sensitive, but this statement is actually not that strict. Because ID selectors and class selectors are case-sensitive, and selectors are the backbone of CSS.
For example, the following code
<p class="box"></p> <p id="case"></p> <style> /*有效*/ p { width: 100px; height: 100px; border: 1px solid; } /*无效*/ .Box { background: red; } /*无效*/ #Case { background: blue; } </style>
Recommended: "css video tutorial"
This is the code above Effect.
In the selector:
Class selectors and ID selectors may be case-sensitive. This depends on the language of the document. HTML and XHTML define class and ID values as case-sensitive, so the case of class and ID values must match the corresponding values in the document.
—— W3C
recommends using lowercase letters.
The above is the detailed content of Are css attributes case sensitive?. For more information, please follow other related articles on the PHP Chinese website!