Universal selector * - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:Universal selector

Description

The * selector selects all elements and nested elements.

Example

Select all elements inside <div> elements and set their background color to yellow:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
div * {<!--   w  w  w .ja  va2  s.  c o  m-->
    background-color: yellow;
}
</style>
</head>
<body>

<h1>Welcome to My Homepage</h1>

<div class="intro">
  <p id="myId">this is a test.</p>
  <p id="myElement">this is a paragraph.</p>
</div>

<p>I <b>like</b> css.</p>

</body>
</html>

Related Tutorials