- 3
Please guys try to help me find my error in this syntax of background color
#bg{ Background-color: red }
43 Antworten
+ 2
Ok, this is how it would look like
<body>
<h1 id="bg"> my brief intro </h1>
</body>
+ 3
You are missing the semicolon at the end of 'red'
+ 2
No I didn't put the id
+ 2
Mani Singh edit your post to [Solved] so that members will stop repeating the same answer.
+ 1
#bg{
Background-color: red;
}
semicolon should solve your error
+ 1
What I am thinking is the problem in the html code
+ 1
No
I didn't put Id on html code
Is this because of ID attribute
+ 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
+ 1
Mani Singh use like this
<h1 id="bg">Some text</h1>
<style>
#bg{
background-color:red;
}
</style>
+ 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;}
+ 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;
}
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
0
did you put the id attribute in the corresponding html tag? Can you share your code playground?
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
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"
0
Again, can you share your code playground? It would be easier to see the problem
0
<body>
<h1> my brief intro </h1>
</Body>
This the html code
0
I am trying change the background on this text
0
Okay let me try it
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">