"CSS" of the Web standard learning path: 12. Rules

Source: Internet
Author: User

Rules

At-Rules
Style Sheet rules

CSS version
Version

Compatibility
Compatibility

Description
Introduction

@ Import

Css1

Ie4 +

Specify the imported external style sheet and Target media. This rule must be first declared in the style sheet Header

@ Charset

Css2

Ie4 +

Used in an external style sheet file. Specifies the character set used by the style sheet. SeeAppendix: Character Set

@ Font-face

Css2

Ie4 +

Set embeddingHtmlDocumentOpenTypeFont

@ Fontdef

NSProprietary rules

Ns4 +

Set embeddingHtmlDocument font

@ Media

Css2

Ie5 +

Specify a style sheet rule for the specified media type

@ Page

Css2

Ie5.5 +

Set the layout, direction, and edge space of the page container.

@ Import

 

Syntax: @ Import URL (URL) smedia;

 

Description:

URL:Use an absolute or relative address to specify the imported external style table file. See link object

Smedia: Specify the device type. See Appendix: device type. Currently, ie5.5 does not support this attribute.

 

Specify the imported external style sheet and target device type.

This rule must be first declared in the style sheet header. The semicolon is required. If this Semicolon is omitted, the external style sheet cannot be correctly imported and an error message is generated.

The owningelement feature of a style table imported using this rule is a link object or style object. See my other books.

The definitions in the imported external style sheet will be overwritten by the same name definitions in the document.

 

Example:

@ Import URL ("foo.css") screen, print;

@ Import "print.css"

@ Charset

Syntax: @ Charset scharacterset

 

Description:

Scharacterset:Character Set Name

 

Used in an external style sheet file. Specifies the character set used by the style sheet. See Appendix: character set.

In an external style sheet file, this rule can only occur once. It must be at the beginning of the style sheet.

For an internal style sheet, its character set is specified by the character set of the HTML document. See the content attributes (features) of the meta object ).

 

Example: @ charset "shift-JIS ";

 

@ Font-face

Syntax: @ font-face {font-family: Name; SRC: URL (URL); srules}

 

Note:

Name: font name

URL: Specifies the opentype font with an absolute or relative address.

Srules: style sheet Definition

 

Set the font of the embedded HTML document.

The font used to embed HTML documents is to map the opentype font (compressed TrueType font) file to the client system to provide HTML documents with this font, or replace the existing fonts of the same name in the client system.

 

Example: @ Font-face {font-family: dreamy; font-weight: bold; SRC: URL (http://www.example.com/font.eot );}

 

@ Fontdef

Syntax: @ fontdef {URL (URL )}

 

Description: URL: Specifies the font definition file embedded in HTML documents using the absolute or relative address.

Set the font of the embedded HTML document.

 

Example: @ fontdef URL ("http://www.example.com/sample.pfr ");

 

@ Page

Syntax: @ page label pseudo-class {srules}

 

Note:

Label: Tab

Pseudo-class: pseudo class. : First |: Left |: Right

Srules: style sheet Definition

 

Set the layout, direction, and edge space of the page container.

The page container includes the blank side padding area of the page content area and content area.

 

Example: @ Page thin: first {size: 3in 8in}

 

@ Media

Syntax: @ Media smedia {srules}

 

Description:

Smedia:Specify the device name. See Appendix:Device Type

Srules: style sheet Definition

 

Specify a style sheet rule for the specified device type. See Media attributes (features) of link objects ).

 

Example:

// Set the display font size

@ Media screen {

Body {font-size: 12pt ;}

}

 

// Set the Printer Font Size

@ Media Print {

@ Import "print.css"

Body {font-size: 8pt ;}

}

 

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.