UNIVERSAL SELECTORS

  • The universal selector is used as a wildcard character. It selects all the elements on the pages.
  • As the name suggests, Universal Selector in CSS is used to select all the elements on the HTML page, such as etc.
  • Therefore, CSS styles applied to the universal selector affect every element on the web page including.
  • Asterisk (*): symbol denotes the universal selector in CSS.
  • What is the Use of Universal Selector (*) in CSS?
  • Maintaining consistent styles across browsers is tricky because each browser provides default styles for HTML elements.
  • You want to reset all HTML element's padding and margin value to 0. Doing this work manually by selecting each element is too much work. That's where the universal selector comes in to save us as it selects all the elements and applies the defined styles to all the elements.
    Example of Universal selectors

    Conclusion

  • Universal Selector in CSS is used to select all the elements on the HTML page.
  • It is denoted by an asterisk (*).
  • You can also combine the universal selector with a namespace.
  • You can even use the universal selector to combine it with other fun/useful things.