Windows Programming and Scripting Language

In this section

CSS Introduction

Why Use CSS?

CSS Syntax

CSS Seclector

  1. The Universal Selector: Rather than selecting elements of a specific type, the universal selector quite simply matches the name of any element type.
  2. Ex.
               *{
                    color: red;
                }
                
  3. The Element Selector: : The element selector selects elements based on the element name. You can select all p elements on a page like this (in this case, all p elements will be center-aligned, with a red text color).
  4. EX.
               p { 
                    text-align: center; 
                    color: red; 
                } 
  5. The Descending Selector:Suppose you want to apply a style rule to a particular element only when it lies inside a particular element. As given in the following example, style rule will apply to em element only when it lies inside ul tag.
  6. EX.
               ul em { 
                    color: #000000;  
                }            
  7. The Id selector:
  8.            #para1 { 
                    text-align: center; 
                    color: red; 
                }
  9. The Class Selector:
  10.            .center { 
                    text-align: center; 
                    color: red; 
                }