This article mainly introduces the use of the character encoding declaration in CSS, has a certain reference value, now share to everyone, the need for friends can refer to
@charset "Utf-8", in the CSS file to indicate that the CSS file page encoding for UTF-8, below we will take this as an example of the CSS in the use of the character encoding declaration of some points of attention, the need for friends can refer to the following
Many people in the style will define @charset "Utf-8", but also some people do not define, the role of this property is in fact to force the declaration of your CSS document type properties, the correct use of it will make your document type lock to you want, but often many people do not define this property, West I didn't come to see how the definition is correct.
Define this property first it must appear that the first row of the document property is required to take effect:
@charset "Utf-8"; . test{ margin-top:30px; }
The following wording is an invalid notation:
Comment written before declaration is not valid:
/* Test test */@charset "utf-8"; . test{ margin-top:30px; }
2. The declaration must be in the first line, otherwise invalid:
@charset "Utf-8"; . test{ margin-top:30px; } 3. The declaration cannot be preceded by a space: @charset "Utf-8"; . test{ margin-top:30px; }
4. Declare document type format must use double quotation marks, single quotation marks are invalid:
@charset ' Utf-8 '; . test{ margin-top:30px; }
The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!
Related recommendations:
On the application of CSS pseudo-elements