Introduction to CSS Universal Selector

Introduction to CSS Universal Selector

Introduction to CSS Universal Selector

This Blog You Will Learn

   Introduction to css universal selector

 ஃ  Syntax:

 ஃ CSS Universal Selector Important Points

 ஃ  Syntax:
 
 structure diagram examples

 ஃ Examples

  Output


 Introduction to css universal selector

  1. CSS universal selector is a  represented by asterisk symbol (*) .
  2. CSS Universal selector  use to select all html element on web page and apply the same css rules to them.
  3. CSS universal selector defined (*)
  4. Every element  in the document regardless of type.
  5. Universal selector use global style.
  6. Universal reset default  browser style.

Syntax :

     *{
           property: value;
       }

CSS Universal Selector Important Points

  •  CSS Universal selector use asterisk (*)
  • Targets every  element
  • use for resetting css
  • Applies styles globally

 structure diagram examples

CSS universal selector



Introduction to CSS Universal Selector

Example 

<!DOCTYPE html>
<html>
<head>
    <style>
     p{  text-align:center;
         color:rgb(19, 47, 253);
         
             }
             div *{
                background-color: yellow;
             }
    </style>
</head>
<body>
      <div class ="pro">
       <h2> CSS Universal Selector (*)</h2>
       <p>Hello every one</p>
      <p>learn to programming language</p>
        </div>
     <p>HTML,CSS,PHP</p>
    <p>https:
//webdesigningtheory.blogspot.com/</p>
  </body>
  </html>

Introduction to CSS Universal Selector

Explain Program

Step  1] 

<!DOCTYPE html>

  • This declare the document type.
  • browser that the document is written in html

Step 2]

<html>.... . </html>

  • html is the root element of the html page.
  •  Every thing inside it is part of the webpage.

Step 3]

<head>
    <style>
     p{  text-align:center;
         color:rgb(19, 47, 253);
         
             }
             div *{
                background-color: yellow;

             }
   

    </style>
</head>

  •   <head>  section 

  •   head section contains metadata about page. not visible on the page itself.
  •    2.    CSS Style  
  • all <P> and <h2> element applies the same style .
  • text-align:center;          =  text is centered 
  • color:rgb(19,47,253);   =  blue text color
  • paragraph <P> tag And heading <h2> tag  on the centered and Blue.

 
<div>
       <h2> CSS Universal Selector (*)</h2>
       <p>Hello every one</p>
      <p>learn to programming language</p>
        </div>

  • (*) use universal selector 
  •  div* =  Select all element inside any <div> tag .
  • background-color:yellow;
  •  yellow background color  to everything inside the </div>
  • <h2>tag and <p> tag inside the <div> tag get a yellow background color 

Step  4] 

 <p>HTML,CSS,PHP</p>
<p>https://webdesigningtheory.blogspot.com/</p>

 <p> tag  center aligned and background color blue.

Step 5] 

closing the Tag


  </body>
  </html>

Introduction to CSS Universal Selector

Output

css universal selector

Related Post :-

how to use the HTML img tag

how to create Nested lists in HTML

How to HTML sub tag

Comments

Popular posts from this blog

HTML Tag

HTML Input Type Submit Syntax and Example

CSS Text Color Explained with Syntax and HTML Examples