Background Color


#1


Hi!
So I'm currently at Background Color in HTML Basics II. I've been working at this one for a few hours and I still can't seem to get it right. The background-color doesn't change like it should.
What am I doing wrong?
Thanks!


https://www.codecademy.com/en/courses/web-beginner-en-y2Yjd/2/1?curriculum_id=50579fb998b470000202dc8b


<!DOCTYPE html>
<html>
	<head>
		<title>Sexy background color!</title>
	</head>
	<body>
		<h3> <p style="background-color: brown;"> Favorite Football Teams</h3></p>
			<ol> <p style="background-color: yellow;">
				<li> The Hawthorn Football Club</li>	
				<li>  San Franscisco 49ers</li>
				<li>> Barcelona FC</li> 
				</p> 
			</ol>			
	</body>
</html>


#2

If you want your whole thing to be brown, put the style="background-color: brown;" into your <body> tag.
Also, if you ever want to have a background colour for <h3>, you don't need a <p> to put that in.
Same applies for <ol>. Just do <ol style="background-color: yellow;">. No need for the <p> tag.


#3

Thank you! That helped me so much!:relieved: I'll make sure not to use the < p > tag in the future. Thanks again!


#4

<p> is great for paragraphs. I hope you don't mean to never use it :sweat_smile:


#5

Yeah, I'll use it for paragraphs, just not in background color-ing anymore. :grin: :wink:


#6

Hi,

Absolutely your background-color should not be apply because your Code syntax is completly wrong. As per your Code you have write like this

  `<h3> <p style="background-color: brown;"> Favorite Football Teams</h3></p>`

its wrong. you cant write like this.

You need to write like this

<!DOCTYPE html>
<html>
	<head>
		<title>Sexy background color!</title>
		<style>
			.demo li
				{
					background-color:yellow;
				}
		</style>
	</head>
	<body>
		<h3><span style="background-color:green;">Favorite Football Teams</span></h3>
			<ol class="demo"> 
				<li> The Hawthorn Football Club</li>	
				<li>  San Franscisco 49ers</li>
				<li>> Barcelona FC</li> 
				</p> 
			</ol>			
	</body>
</html>

If you want to apply color to header so you need to use tag instead of

tag.

THANK YOU,
Divyesh Padamani


#7

In that lesson, CSS and its syntax are not taught yet. Including CSS selectors.


#8

Thanks for all the help! I've managed to move on to HTML III now. :grin:


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.