What is selector and universal selector?

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOps School!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Universal Selector

A universal selector is a selector that matches any element type’s name instead of selecting elements of a particular type. The universal selector becomes helpful when you wish to put a specific style in all the HTML elements within your web page

syntax

* {
     property : value;
  }

uses the asterisk (“*”) symbol used for denoting the selector as a universal selector. It is usually written as an asterisk followed by a selector. The * is used for selecting all elements. This asterisk also has the capability to select all elements that are inside another element.

example

* {
     margin : 0px;
     padding : 0px;
  }

There are some additional properties of Universal selector, where you can make use of a combination of asterisk with namespace:

  • ns|* – this will allow you to match all elements within the namespace ns.
  • *|* – this will allow you to match simply all elements.
  • |* – this will allow you to match all elements that are without any declared namespace.

Selectors

CSS selectors are used to select the content you want to style. Selectors are the part of CSS rule set. CSS selectors select HTML elements according to its id, class, type, attribute etc.

There are several different types of selectors in CSS.

  • CSS Element Selector
  • CSS Id Selector
  • CSS Class Selector
  • CSS Universal Selector
  • CSS Group Selector

example

<!DOCTYPE html>  
<html>  
<head>  
<style>  
p{  
    text-align: center;  
    color: blue;  
}   
</style>  
</head>  
<body>  
<p>This style will be applied on every paragraph.</p>  
<p id="para1">Me too!</p>  
<p>And me!</p>  
</body>  
</html>

Related Posts

Mastering the DevOps Salary Landscape: A Comprehensive Guide

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps! We spend hours scrolling social media and waste money on things we forget, but won’t spend 30…

Read More

The Complete DevOps Certification Guide: From Beginner to Expert Architect

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps! We spend hours scrolling social media and waste money on things we forget, but won’t spend 30…

Read More

A Guide to Selecting the Right DevOps Training Format

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps! We spend hours scrolling social media and waste money on things we forget, but won’t spend 30…

Read More

DevOps Certification Training: Identifying Quality and Expertise

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps! We spend hours scrolling social media and waste money on things we forget, but won’t spend 30…

Read More

Complete DevOps Training Guide for Assessing Mentor Technical Competence

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps! We spend hours scrolling social media and waste money on things we forget, but won’t spend 30…

Read More

Mastering Your Future: The Complete Guide to the Canada PR CRS Calculator

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps! We spend hours scrolling social media and waste money on things we forget, but won’t spend 30…

Read More
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x