Browse Source

select-and-style: add code examples of css

content-update
Marie Malarme 3 years ago committed by Clément
parent
commit
6b72e728c2
  1. 16
      subjects/select-and-style/README.md

16
subjects/select-and-style/README.md

@ -26,9 +26,11 @@ style it with [CSS][0]. Create a CSS file, [link it][1] to your
- `upper-body` with a "blueviolet" `background-color`
- `lower-body` with a "lightsalmon" `background-color`
To style an element, you systematically have to declare [rulesets][5], composed
of a property and a value. Here is an exemple of how to set the color of `div`
tags to `"red"`:
### Code examples
To style an element, you systematically have to declare [rulesets][5], composed of a property and a value.
Set the color of `div` tags to `"red"`:
```css
div {
@ -36,6 +38,14 @@ div {
}
```
Set the `background-color` of the HTML element with the `id` `"block-1"`:
```css
#block-1 {
color: red;
}
```
### Expected output
This is what you should see in the browser: ![screenshot][8]

Loading…
Cancel
Save