Searching...
Saturday, 29 September 2012

CSS : Selectors In Css

11:02 pm

CSS : Selectors In Css

CSS : Selectors In Css:

1.       Type Selector: where this selector is an html tag
P
{
Font-family:arial;
}
2.       Class Selector: Where selector is name prefiexd with dot(.) and that can appled to an html element using “class” attribute
.MySytle
{
text-align:center;

}
3.       ID Selector: where selector is identification of region
Prefixed with #
#myregion
{
Color:red;
}
<DIV  id=”Myregion”>
……
</DIV>
4.       Adjecent sibling Selector(Support in FireFox):
LI +LI
{
Color:green;
}
<UL>

<Li>one
<li>two
</ul>
CSS Exmple 3: External Style Sheet with ID  Selector and Adjectent sibling Selector

MyStyle1.CSS

#Myregion
{
width:260PX;

Hight:110PX;
Background-color:red;
Margin-left:400PX;
Margin-top:100PX;
Padding:20PX;
Position:absolute;
}
LI+LI
{
color:blue;

}

CSS Text3.html

<html>
<head>
<link rel=”style Sheet” Type=”text/css” href=”Mystyle1.css”/>
</head>
<body>
<DIV ID=”myregion”>
<IMG SRC=”image/img1.jpg” width=”240” hight=”100” align=”center” />
</DIV>
<ol style=”font-family:vardhana;font-size:22PX”>
<li >one
<li>two
</ol>
</body>
</html>

1 comments: