:
;
h1 {color: purple;}
div p {color:red;}
#
Rule: #center {text-align: center;}Use: <p id="center">Text</p>
.
Rule: (.purple { color: purple; })Use: <h2 class="purple">Text</h2>
Rule: (.purple { color: red; } .italic { font-style: italic; } )Use: <h2 class="purple italic">Text</h2>
(more on selectors on W3C)
h1 { font-weight: bold }h1 { font-size: 12px }h1 { line-height: 14px }h1 { font-family: Helvetica }h1 { font-variant: normal }h1 { font-style: normal }
h1 { font-weight: bold; font-size: 12px; line-height: 14px; font-family: Helvetica; font-variant: normal; font-style: normal}
h1 { font-family: sans-serif }h2 { font-family: sans-serif }h3 { font-family: sans-serif }
h1, h2, h3 { font-family: sans-serif }
H1 B { color: red }H2 B { color: red }H1 EM { color: red }H2 EM { color: red }
H1 B, H2 B, H1 EM, H2 EM { color: red }
<style type="text/css"> .bodytext { font-size: 30px; font-family: Arial; } .bodytext p { font-size: 0.6em; line-height: 1.2em; width: 12em; background-color:#e9e9e9; } </style> <div class="bodytext"> This is text in the bodytext div. <p>This is test within the P element.</p> </div>
<html><body><p style="color: green; font-family: verdana">This text is in green verdana.</p></body></html>
<html><head><style TYPE="text/css"> body {font: 12px; color: green;} h1 {font: 24px; color: red;} p {font: 10px; color: black;}</style></head><body><h1>This is a sample for embedded style sheet</h1><p>This is a text line</p></body></html>
<html><head> <link rel=stylesheet href="style sheet filename" type="text/css"></head><body><h1>This is a sample for embedded style sheet</h1><p>This is a text line</p></body></html>