8. Different Types of Selectors

Selectors are used to specify what XHTML MP elements should a WAP CSS style rule be applied to. Up to now, we have used only one kind of selector called the type selector in cascading style sheets. There are other kinds of selectors available in WCSS and they can be very useful to you. You can learn some of the more useful ones below.


8.1. Type Selector

In all the WAP CSS examples mentioned previously, we used XHTML MP element names as the selector. Such kind of selector is called the type selector. It should be noted that element names are case-sensitive in XHTML MP and they must be in lowercase. This means type selectors in WCSS cascading style sheets must also be in lowercase. For example, the following WCSS code is incorrect because the type selector "H1" is not in lowercase.


H1 {
  font-style: italic
}


This is the correct version of the above WCSS code:


h1 {
  font-style: italic
}


The above style statement specifies that the style rule "font-style: italic" should be applied to all <h1> tags.


Previous Page Page 7 of 39 Next Page


A button for going back to the top of this page