Selecting All Elements

Description

The universal selector selects every element in the document.

  • Selector:*
  • Matches: All elements
  • CSS Version:2

The universal selector does match every element in the document, including the html and body elements.

Example

The following code shows an example of a style that uses the universal selector.


<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
* {<!--from  w ww  .j a  v  a2s  .  com-->
  border: thin black solid;
  padding: 4px;
}
</style>
</head>
<body>
  <p>
    This is a <span>test</span>.
  </p>
  <a href="http://w3c.org">W3C</a>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table