HTML and CSS Reference
In-Depth Information
Selector or
Construct
Description
Example
Defined In
@media
Groups style rules for multiple
media types in a single style
sheet
@media screen {body
{font-family: sans-serif;
font-size: 18 pt;}
}
CSS2
Used to define rules for page
sizing and orientation rules for
printing
CSS2
@page
@page {size: 8.5in 11in;}
Sets page layout rules for the
first page in a document when
printing
CSS2
:first
@page :first {margin-top:
1.5in;}
:left
Sets page layout rules for a
left-hand page when printing
@page :left {margin-left:
4cm; margin-right: 2cm;}
CSS2
:right
Sets page layout rules for a
right-hand page when printing
@page :right {margin-left:
6cm; margin-right: 3cm;}
CSS2
T ABLE 5-6 CSS2 Page and Media Selector Summary
Miscellaneous CSS Constructs
This section discusses some miscellaneous constructs associated with style sheets.
/* comments */
Comments can be placed within style sheets. Style sheets use the comment syntax used in C
programming ( /*comment*/ ):
<style type="text/css">
p {font-face: Courier; font-size: 14px; font-weight: bold;
background-color: yellow;}
/* This style sheet was created at Demo Company, Inc. for the express purpose
of being an example in HTML & CSS: The Complete Reference, 5th Edition */
/* Oh by the way people can see your comments so think twice about what you
put in them */
</style>
HTML comment syntax ( <!-- comment --> ) does not apply in CSS. However, as
discussed previously in the “Style Inclusion Methods” section, HTML comments are often
used to mask style blocks:
<style type="text/css">
<!--
p {font-size: 1.5em; font-family: Georgia, "Times New Roman", Times, serif;
Search WWH ::




Custom Search