HOME
            About US
            Contact Us
            Fun Games

CSS Class Selector
CSS Class SelectorCSS Class Selector

14.2 CSS class selector: (Page 3/5)


(Cotinued from previous page)

14.2- Class Selector: The class selector is used to specify a style for a group of elements. The class selector is defined by a symbol '.'

.new { font-size: 10px; font-color: blue; }
Here 'new' is a class and in this class all text will be of blue color with font size of 10 px.

Following is one example, how it will be used in HTML
<p class='new'>Text in a paragraph form</p> This line is written in HTML file

NOTE : Please note that 'id' selector and 'class' selectors always form a unique combination and one class selector can be used for many elements.



14.3 - Pseudo Elements: CSS pseudo-elements are used for some special decorations to selectors. These can be used only with few specific selectors only. They are used with some other element as decorator and therefore called as pseudo element. The pseudo element give special effect to the Web Page e.g. if you want to inform your visitor, about the link he has already visited then use 'a:visited' element and highlight that link with a different color.

The command is written in following format
Selector:pseudo-element {property:value;}

The main pseudo elements are.
i) Anchor Pseudo-classes: This is used to give special effect to 'link text'. A links can be displayed in four ways.

a) Unvisited link : A link which is still not visited
b) Visited link : This link is visited at least once.
c) Mouse Over link : At present the curser in on this link.
d) Selected link : At present this link is active.

It's not necessary to use all the above four style, but whenever it is used, it should be in same sequence. This is defined in detail in Chapter 21.0

(Cont......... to next page (Pg-4))

© funandhobby.com (CSS Class Selector)