CBSE - VIII - CS - Using CSS in HTML
CBSE - VIII - CS - Using CSS in HTML
Std: VIII
selector property
value
h1 { color:red; font-size:14px ; }
property value
body{ color:#0000FF;
background-color:yellow;
Text color, Background color and
background-image:url(“back.gif”); } color of text is specified
• Inline style
• Internal Style sheet
• External Style sheet
p
{ style=“color:blue;
margin-right:20px;”
}
<head>
<style type=“text/css”>
p { color:blue;
margin-right:20px; }
hr { color:sienna;}
</style>
</head
<head>
<link rel=“stylesheet”
type=“text/css” href=“style1.css”>
</head>
• id selector
<style> #pg1 { color:red; } </style>
<p id=“pg1”> Hello world</p>
• class selector
<style> .cent { color:red; } </style>
<h1 class=“cent> Hello world</h1>
h1{background-color:#b0c4de;}
body{background-image:url(“lotus.gif”);
background-repeat:no-repeat;
background-position:right top;}
h1{text-align:right;} p.main{text-align:justify;}
• text-decoration
h2{text-decoration:underline;}
• text transform
p.main{text-transform:capitalize;}
• text indent
p{text-indent:50px;}
Examples--
p.itc { font-style:italic; }
p.thick { font-weight:bold; }
p.thicker { font-weight:900; }
p { font-family: “Times New Roman”, Times, Calibri; }