In addition to what we often write in CSS, there are @import @namespce like @charset @keyframes @media @page @font-face @viewport.
1, @charset used within an external style sheet file. Specifies the character encoding used by this style sheet. The semicolon following the rule is required, and if this semicolon is omitted, an error message is generated.
@charset "Utf-8"; html{***}
2, @import Specify the imported external style sheet and target media.
Grammar:
@import <url> <media_query_list>
<url>: Use absolute or relative addresses to specify imported external style sheet files. can be a URL (URL) or directly a URL
<media_query_list>: Specifies the media type and query criteria.
<media_query_list>: [<media_query>[', ' <media_query>]*]?
<media_query>: [only | not]? <media_type> [and <expression>]* | <expression> [and <expression>]*
<expression>: ' (' <media_feature>[:<value>]? ') '
@import url ("Global.css"), @import url (global.css), @import "Global.css", @import url (example.css) screen and (min-width : 800px), @import url (example.css) screen and (width:800px), (color), @import url (example.css) screen and ( min-device-width:500px) and (MAX-DEVICE-WIDTH:1024PX);
3, @namespce declare an XML namespace prefix in the CSS. This works well when you use a selector that matches only the elements under a particular namespace.
4, @keyfames used to set the animation
5, @media Specify a style sheet rule for the specified media type and query criteria.
Syntax:@media: <media_query_list>, can be used in @meida and @import as well as in HTML.
@media screen and (width:800px) {}@import url (example.css) screen and (width:800px), <link media= "screen and (width:800px)" Rel= " Stylesheet "href=" Example.css "/>
The media types available for all browsers are: All,screen,print. Handheld is available for Chrome Safari and opera.
6, @page retrieves or specifies the type of page to use when displaying the object container
7, @font-face Set the font for the embedded HTML document. typically, both the. TTF (TrueType) and. OTF (OpenType) font formats are used.
Grammar:
@font-face {font-family:name;src:<url>;srules;}
<name>: Font name
<url>: Use absolute or relative addresses to specify OpenType fonts
<srules>: style sheet definition. Include (Font-style: Sets the text style.
Font-variant: Sets whether the text is case-sensitive.
Font-weight: Sets the thickness of the text.
Font-stretch: Sets whether the text is stretched horizontally.
Font-size: Sets the text font size. )
@font-face { font-family:YH; src:url (Http://domain/fonts/MSYH.TTF);} Media query zooms the viewport less than 400px to a width of 320px.
8, @viewport need to add a prefix
{ @-ms-viewport {width: 320px;} ...}
9,!important is used to elevate the application priority of the specified style rule, which is not supported in IE6 and previous browsers.
. classes{ Color: #f00!important; Color: #ff0; } It is shown in red, not yellow. But it is yellow in IE6.
CSS Syntax Summary