HTML backround color not showing anyone know why

The body background color is not showing, it worked a few minutes ago but not anymore… can anyone help?

<!doctype html>

<html>
<head>
	<style type="text/css">
	
		<!-- modifying body -->
		body{background-color:red;}
		
		<!-- modifying h1 heading -->
		h1{font-weight:bold;		
		color:white;
		text-decoration:underline;		
		font-style:italic; 
		text-align:center;
		font-size:100px;
		margin:1px;}
		
		<!-- modifying h2 heading -->
		h2{font-weight:bold; 
		color:white; 
		font-style:italic; 
		text-align:center;
		font-size:40px;
		text-decoration:underline;}
		
		<!-- modifying paragraph -->
		p{color:white; 
		font-family:arial; 
		line-height:130%;
		text-align:justify}
		
		<!-- modifying links -->
		a:link{color:red; text-decoration:none;}
		a:visited{color purple;}
		a:hover{background-color:green; color:white; font-weight:bold; text-decoration:underline;}
		a:active{backround-color:orange;}
		
		<!-- modifying Unordered table -->
		ol{background-color:#8f4579;}
		ol{color:white;font-family:arial;font-weight:bold;}
		
		<!-- modifying table -->
		table{border: 3px solid green;}
		tr{background-color:#8f4579;}
		th{border: 2px solid yellow;}
		td{border: 2px solid pink;font-style:italic}
	</style>
</head>

do you have any content in the body?

Yes i do… what happened was , in the tables tab i wrote color : white reloaded the page and background changed. I undid the changes and still the same.

maybe you need to reload again?

Hi @dfor54!

I copied your css code and threw it into codepen and got this result.

But I am not really sure what you mean by tables tab.

Sorry i meant in this line table{border: 3px solid green;}
I took it out and the backround remained white.

I’ve tried. still the same result.

1 Like

I can only seem to get it to work in a seperate css section.
So you might want to try that.

Also this is the proper <!DOCTYPE html> not this <!doctype html>

2 Likes

thanks so much. I found it what the problem was but have no idea why. it was the comments.

ok :slight_smile: me alegro

1 Like

you are right, to write comments in css you need to use /* to start and */ to end the comment

2 Likes

Thanks i did not know that. I’m new to HTML.

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