CSS - @ rules

CSS at-rules are directives (instructions) to the CSS interpreter. ref.


Directive Description & Example
@charset

Sets the character set encoding for this file.

@charset = "iso-8859-1";
@font-face

Use to load custom fonts.

@font-face {
 font-family: 'MyFont';
 src: url('webfont.eot');
}

Reference the new font as usual:

body {
 font-family: 'MyFont';
}
@import

Use to import another CSS file.

 @import "default.css";
@media
Use to declare media type specific CSS rules.
@media print
body {
 background-color: white;
}
@namespace

Use to change the default namespace, or declare a new namespace.

@page

Use to configure the page for printed output.

@page {
 size: 8.5in 11in;
 margin: 4em;

 @top-left {
  content: "Report";
 }
 @top-right {
  content: "Page " counter(page);
 }
}

Ads by Google

Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath