I have a class named body. I'm adding some CSS to it. I already had a property called background color and I'm trying to add another property, once I added it both properties it wasn't working and I want to know why?
-
1Please add more [details](https://stackoverflow.com/help/minimal-reproducible-example) – Meraj al Maksud Sep 21 '19 at 20:16
5 Answers
You need to give more details about the problem you are having. Also note that with css property and value declaration should end with a semicolon.
.body {
background-color: blue;
color: red;
}

- 26
- 1
You don't need to declare body as class again unless you add something to it, body is global class and not really need to be re-declare again.

- 1
- 1
You should have stated your question by adding the code here to know where your error is, but you can note this:
make sure in your CSS, your prperty starts with point, i.e the full stop symbol, so it should be
.body
inside your parenthesis, that is the curly brackets, write your property, followed by a colon and the its attribute followed by a semi-colon, the you proceed with another property. sample
HTML
<div class="body">This is the class named body</div>
CSS
.body {background: blue; color: red;}

- 19
- 1
You might also check your style sheet link to HTML, I mean to if you correctly link main. Css file to your html Index.

- 1
- 2