- 3

Please guys try to help me find my error in this syntax of background color

#bg{ Background-color: red }

9th Aug 2022, 3:38 AM
Mani Singh
Mani Singh - avatar
43 Answers
+ 2
Ok, this is how it would look like <body> <h1 id="bg"> my brief intro </h1> </body>
9th Aug 2022, 4:41 AM
Andrés Sebastián López
Andrés Sebastián López - avatar
+ 3
You are missing the semicolon at the end of 'red'
9th Aug 2022, 4:09 AM
Andrés Sebastián López
Andrés Sebastián López - avatar
+ 2
No I didn't put the id
9th Aug 2022, 4:25 AM
Mani Singh
Mani Singh - avatar
+ 2
Mani Singh edit your post to [Solved] so that members will stop repeating the same answer.
10th Aug 2022, 3:24 PM
Chris Coder
Chris Coder - avatar
+ 1
#bg{ Background-color: red; } semicolon should solve your error
9th Aug 2022, 4:16 AM
Bahar Hasanova
Bahar Hasanova - avatar
+ 1
What I am thinking is the problem in the html code
9th Aug 2022, 4:30 AM
Mani Singh
Mani Singh - avatar
+ 1
No I didn't put Id on html code Is this because of ID attribute
9th Aug 2022, 4:35 AM
Mani Singh
Mani Singh - avatar
+ 1
It's working thanks But how can change the background of whole screen If I apply Id in h1 then it's only changing background of text only instead of whole screen
9th Aug 2022, 4:45 AM
Mani Singh
Mani Singh - avatar
+ 1
Mani Singh use like this <h1 id="bg">Some text</h1> <style> #bg{ background-color:red; } </style>
10th Aug 2022, 2:59 AM
Saddam Hussain
Saddam Hussain - avatar
+ 1
Where you use 'bg ' that's not correct their you have to place selector like body tag to apply on whole document body{ Background-color: linen;}
10th Aug 2022, 12:47 PM
Vasu Srivastav
Vasu Srivastav - avatar
+ 1
Hmm i think first time u need to have a good indentation and afrer the « background-color: red » add an « ; ». Maybe change the B for b so the resultat is #bg{ background-color: red; }
11th Aug 2022, 12:20 AM
Yuru
Yuru - avatar
0
Okay Thank you guys But I did that mistake when I was typing on sololearn Not on vs code I thing the error is something Else Guys do we need need put div in html file to change the background
9th Aug 2022, 4:20 AM
Mani Singh
Mani Singh - avatar
0
did you put the id attribute in the corresponding html tag? Can you share your code playground?
9th Aug 2022, 4:24 AM
Andrés Sebastián López
Andrés Sebastián López - avatar
0
#bg{ background -color: color red; } This what I am trying to do It's not working but when I try to change body color it's working that's also working same like background code
9th Aug 2022, 4:29 AM
Mani Singh
Mani Singh - avatar
0
Sorry, I'm not getting what you want to do... Are you trying to change the background color of the entire body or a div, section, or else? I see you used an Id but I don't get what "isn't working"
9th Aug 2022, 4:34 AM
Andrés Sebastián López
Andrés Sebastián López - avatar
0
Again, can you share your code playground? It would be easier to see the problem
9th Aug 2022, 4:36 AM
Andrés Sebastián López
Andrés Sebastián López - avatar
0
<body> <h1> my brief intro </h1> </Body> This the html code
9th Aug 2022, 4:39 AM
Mani Singh
Mani Singh - avatar
0
I am trying change the background on this text
9th Aug 2022, 4:40 AM
Mani Singh
Mani Singh - avatar
0
Okay let me try it
9th Aug 2022, 4:42 AM
Mani Singh
Mani Singh - avatar
0
anyway this will only work in code playground. In a web page made outside of Sololearn app you have to put the tag to link the css stylesheet <link rel="stylesheet" src="style.css">
9th Aug 2022, 4:46 AM
Andrés Sebastián López
Andrés Sebastián López - avatar