Introduction to CSS Universal Selector
Introduction to css
universal selector
- CSS universal selector is a represented by asterisk symbol (*) .
- CSS Universal selector use to select all html element on web page and apply the same css rules to them.
- CSS universal selector defined (*)
- Every element in the document regardless of type.
- Universal selector use global style.
- Universal reset default browser style.
Introduction to CSS Universal Selector
Syntax :
*{
property: value;
}
Introduction to CSS Universal Selector
Example
<html>
<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
