CSS - Element Selector

CSS - Element Selector

  • The element selector selects elements based on the element name. 
  • Elements can occur more than once (repeating) within the same level, while attributes can only appear once within the same level.

Syntax :

          css declaration;

Sample Code :

<!DOCTYPE html>
        p   {
             text-align: center; 
             color: red;   
             <p>Welcome To Wikitechy!!!</p>   

Code Explanation :

    Here, p is an element tag where we are going to apply css declarations for it. 

    Using text-align property with its value as center will display the paragraph text contents in the center of the web page/website.

    Here color: red; defines the color property for the text “Welcome To Wikitechy!”

Output :

    The text “Welcome To Wikitechy!” was in center alignment with its text as red color which is displayed in the output window.