id
class
h1
p
p {color:red;} /* All paragraphs on the page will have a red font.*/
<p id="author-bio"> <h1 id="intro">
tag#id-value {style rules} /* or */ #id-value {style rules} /* recommended */
#author-bio {color:blue;} /* The element with the id="author-bio" will have a blue colored font */
#intro {font-size:24px;} /* The element with the id="intro" will have font-size of 24px */
<head> <style type="text/css"> p {border: 3px solid gray;} #bordered {border: 3px solid red;} </style> </head> <body> <h1>...</h1> <p>…</p> <p>…</p> <p id="bordered">…</p> <!--only this paragraph will have a red border--> <p>…</p> <p>…</p> </body>
<p class="bordered"> <h1 class ="bordered">
tag.class-value {style rules} /* or */ .class-value {style rules} /* different from the tag#class-value */
p.me {color:blue;} /* Every <p> with class="me" will have a blue colored font */ h1.me {font-size:24px;} /* Every <h1> with the class="me" will have font-size of 24px */ .me {color:blue;} /* All the elements of any type with class="me" will have a blue colored font */
<head> <style type="text/css"> p.bordered {border:3px solid red} /* all the paragraphs with class="bordered" will each have a border */ </style> </head> <body> <h1 class="bordered">...</h1> <p>…</p> <p class="bordered">…</p> <p class="bordered">…</p> <p>…</p> <p class="bordered">…</p> </body>
ex06.html
ex04.html
div
span
<body> <div id="one"> <!-- Some HTML tags --> </div> <div id ="two"> <!-- Some HTML tags --> </div> ... </body>
<div>
<span>
yellow
green
lime
1.5em
sitemap.html
global styles