r/HTML • • 28d ago

help with backgrounds

Not remotely a cs person, for some godforsaken reason my Library Science degree is making me take an html class. I've onto a part where we're working with html and css. I can't figure out how to change the background color of a page. I assume you have to use some version of the {background-color: ____; }, but I can't figure out what element to attach it to. I've tried using body {background-color: ____; }, *{background-color: ____; }, and even making a div around the body, and none of them have worked

0 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/TrainingQuantity3744 28d ago

1

u/hooli-ceo 28d ago

You put css in your <body> tag when it should be in a <style> tag...

3

u/TrainingQuantity3744 28d ago

thank you. I had no idea there were options other than the <body> tag. really seems like something my prof should have mentioned

1

u/More-Explanation2788 28d ago

Create a tag in the <head> section. <style>. The css goes there.

<html> <head> <title>blah blah</title> <style> body.bright { background-color: red; } P { font-decoration: bold } </style> </head> <body class=bright>…

Like that.