My Profile

Tuesday, February 1, 2011

CSS Comments



Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers.
A CSS comment begins with "/*", and ends with "*/", like this:
/*This is a comment*/

p

{

text-align:center;

/*This is another comment*/

color:black;

font-family:arial

}
<html>
 <head> <link rel="stylesheet" type="text/css" href="ex1.css" /> </head> <body> <h1>This header is 36 pt</h1> <h2>This header is blue</h2> <p>This paragraph has a left margin of 50 pixels</p> </body> </html>body
{
background-color:yellow;
}
h1
{
font-size:36pt;
}
<html>
    <head>
<link rel="stylesheet" type="text/css" href="ex2.css" />
    </head>
 <body>
 <h1>This is a header 1</h1>
<hr />
<p>You can see that the style sheet formats the text</p>
<p><a href="http://www.w3schools.com" target="_blank">This is a link</a></p> </body> </html>
h2
{
color:blue;
}
p
{
margin-left:50px;
}

 
This is the style sheet file (ex2.css):



body {background-color: tan}
h1 {color:maroon; font-size:20pt}
hr {color:navy}
p {font-size:11pt; margin-left: 15px}
a:link     {color:green}
a:visited  {color:yellow}
a:hover    {color:black}
a:active   {color:blue}

0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More