Universal selector


Universal selector

You can apply styles to all elements in the document by using the universal selector.

The universal selector is an asterisk (*).

* { margin: 0; }

In the above example, the style is applied to all element types in the document.


<html>
<head>
<title>TAG index</title>

<style type="text/css">

* { margin: 0; }

</style>

</head>
<body>

<h1>The style is applied to this heading</h1>
<p>The style is applied to this text.</p>

<h2>The style is applied to this heading</h2>
<p>The style is applied to this text.</p>

<h3>The style is applied to this heading</h3>
<p>The style is applied to this text.</p>

</body>
</html>