fix(guide): Fix solution for style multiple elements and remove stub text (#35530)
This commit is contained in:
committed by
Randell Dawson
parent
ddf2c993f5
commit
28ea71d603
@ -3,17 +3,52 @@ title: Style Multiple Elements with a CSS Class
|
|||||||
---
|
---
|
||||||
## Style Multiple Elements with a CSS Class
|
## Style Multiple Elements with a CSS Class
|
||||||
|
|
||||||
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
|
|
||||||
We need to applying our ```red-text``` class to the first ```p``` element.
|
We need to applying our ```red-text``` class to the first ```p``` element.
|
||||||
|
|
||||||
### Solution
|
### Solution
|
||||||
|
|
||||||
In the opening tag of element ```p``` we need to add ```red-text``` class:
|
In the opening tag of element ```p``` we need to add ```red-text``` class:
|
||||||
|
|
||||||
```css
|
```html
|
||||||
|
<style>
|
||||||
|
.red-text {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<h2 class="red-text">CatPhotoApp</h2>
|
||||||
|
<main>
|
||||||
<p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
|
<p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
|
||||||
|
|
||||||
|
<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>Things cats love:</p>
|
||||||
|
<ul>
|
||||||
|
<li>cat nip</li>
|
||||||
|
<li>laser pointers</li>
|
||||||
|
<li>lasagna</li>
|
||||||
|
</ul>
|
||||||
|
<p>Top 3 things cats hate:</p>
|
||||||
|
<ol>
|
||||||
|
<li>flea treatment</li>
|
||||||
|
<li>thunder</li>
|
||||||
|
<li>other cats</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form action="/submit-cat-photo">
|
||||||
|
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
|
||||||
|
<label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
|
||||||
|
<label><input type="checkbox" name="personality" checked> Loving</label>
|
||||||
|
<label><input type="checkbox" name="personality"> Lazy</label>
|
||||||
|
<label><input type="checkbox" name="personality"> Energetic</label><br>
|
||||||
|
<input type="text" placeholder="cat photo URL" required>
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
</main>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Useful links
|
### More information
|
||||||
|
|
||||||
- [Class selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors)
|
- [Class selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors)
|
Reference in New Issue
Block a user