How to write styles for all html elements of the same type?

 Posted by Raja on 1/9/2009 | Category: CSS 3 Interview questions | Views: 5449
Answer:

If we want to maintain uniformity in the look and feel of all same type of elements on the page, we can write CSS class with the element name.eg.

If we want to change the look and feel of all table and h1 element on the page, we can write like this.

table 

{
font-size:10pt;
font-family: Arial;
}
h1
{
font-size:14pt;
padding-left:5px;
margin:0px;
color:#094BBB;
}



The first class "table" will apply to all the tables on the page and second class "h1" will apply to all the h1 element of the page.

Note that the name of the class is not prefixed with the . (dot) as it happens with normal css class name.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response