Files

17 lines
573 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Use CSS Selectors to Style Elements
---
## Use CSS Selectors to Style Elements
CSS selectors are widely used to apply styling to all instances of a particular element.
2018-10-12 15:37:13 -04:00
To apply the color `purple` to all the `h2`s on the page, you can define the following CSS inside a `<style></style>` block.
2018-10-12 15:37:13 -04:00
```css
h2 {
color: purple;
}
```
This will apply the color `purple` to all `<h2>` headings. If you are using the `style="color: purple"` attribute on each `<h2>` element, you can remove it and instead define it in a single place inside a `<style></style>` block.