The Element Selector

The element selector selects elements based on the element name. You can select all <p> elements on a page like this:

HTML file: Displayed by browser:
<style>
p {
   text-align: center;
   color: blue;
}
</style>

<body>

<p>Every paragraph will be affected by the style.</p>
<p>Me too!</p>
<p>And me!</p>

</body>

Every paragraph will be affected by the style.

Me too!

And me!

All <p> elements will be center-aligned, with a blue text color.

Back buttonTable of ContentsNext button