How to add an background to your website?

I pretty much just want to add an background, to my hello-webpage app. How am I supposed to do that?

Would you like the background to be a color, or image?

If it is color, then in the body tag in your css configuration file have the following

background-color : (color name or hex);

If it is an image:

background-image: (image link);
2 Likes

What about for HTML?

Hi Cryx,

Even though the page is HTML, we still use CSS to set the background image. They’re made to work together! :blush:

Here’s roughly what I’d do:

<html>
<head>
	<style>
		body { 
			background : url(img/flower.png) #b7e500;
		}
	</style>
</head>
<body>
	<h1>My Cool Page</h1>
	<p>Hi</p>
</body>
</html>

That’s how the page would be stuctured. The background all-in-one rule uses img/flower.png if it can find it (replace that with your background image path) and it uses the green colour before the image loads or if the image can’t be found.

Hope that helps :art:

Ste

4 Likes

Oooh! Thanks for your help, SteGriff!

1 Like

oooh! it works tysm guys!