CSS Styles for tags,classes, id selectors

on Tuesday, October 20, 2009

Style1

If you want to style the entire body in a perticular way you would define it like

body
{
font-size:xx-large;
background-color:Black;
color:Aqua;
}

Style2

If you want to style using perticular class name then you would put "DOT(.)" before the name like
.classname
{
font-size:xx-large;
background-color:Black;
color:Aqua;
}

Style3

If you want to style using perticular element having a specific id then you would do something like

a#abc
{
font-size:xx-large;
background-color:Black;
color:Aqua;
}
<a runat="server" id="abc">hello</a>

Style4

If you want to style a specific id then you would do something like

#abc
{
font-size:xx-large;
background-color:Black;
color:Aqua;
}
which will make all the elements with id abc use the above style.

0 comments: