Add hint & example for using CSS selectors. (#24807)

This commit is contained in:
Dhirendra
2019-03-03 23:15:47 +05:30
committed by The Coding Aviator
parent 6f9cad3315
commit 7463e75530

View File

@@ -3,8 +3,14 @@ title: Use CSS Selectors to Style Elements
---
## Use CSS Selectors to Style Elements
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/responsive-web-design/basic-css/use-css-selectors-to-style-elements/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
CSS selectors are widely used to apply styling to all instances of a particular element.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
To apply the color `purple` to all the `h2`s on the page, you can define the following CSS inside a `<style></style>` block.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
```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.