HTML and CSS Reference
In-Depth Information
@ Rules
CSS supports different “@ rules” designed to run commands within a style sheet. These
commands can be used to import other styles, download font definitions, or define the
format of printed output.
@ Rule
Description
@charset “
encoding
”
Defines the character set encoding used in the style sheet (this
must be the very first line in the style sheet document)
@font-face
{
font
descriptors
}
Defines custom fonts that are available for automatic download
when needed (CSS3)
@import url(
url
)
media
Imports an external style sheet document into the current style
sheet, where
url
is the location of the external stylesheet and
media
is a comma-separated list of media types (optional)
@media
media
{
style
declaration
}
Defines the media for the styles in the
style declaration
block,
where
media
is a comma-separated list of media types
@namespace
prefix
url(
url
)
Defines the namespace used by selectors in the style sheet, where
prefix
is the local namespace prefix (optional) and
url
is the unique
namespace identifier; the @namespace rule must come before all
CSS selectors (CSS3)
@page
label
pseudo-class
{
styles
}
Defines the properties of a printed page, where
label
is a label
given to the page (optional),
pseudo-class
is one of the CSS
pseudo-classes designed for printed pages, and
styles
are the
styles associated with the page
Miscellaneous Syntax
The following syntax elements do not fit into the previous categories but are useful in
constructing CSS style sheets.
Item
Description
style
!important
Places high importance on the preceding
style
, overriding the usual rules for
inheritance and cascading
/*
comment
*/
Attaches a
comment
to the style sheet