Use of character encoding declarations in CSS

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.