HTML Background Images

Can someone please explain to me why when I run this code the first two css background properties do nothing where as the src that has no tag runs just fine?

<!DOCTYPE html>
<html>
<head>
	<title>TEST</title>
	<style type="text/css">
		.body {
			background-image: url(image/face.jpg);
		}
	</style>
</head>
<body style="background-image: url(image/face.jpg);>
src="image/face.jpg"
</body>
</html>

Of the top of my head, when you first declare the style, you target it with .body - the period indicates it is class. But body is an element, not a class - try it without the period.

This refers to any element with that’s given the 'body' class, not necessarily the <body> element itself (note the dot before body here; you want to remove it).

You’re missing a " after the semicolon.

Also, inside the url function, the file path should be in quotes.

I realised the .body error after posting :stuck_out_tongue:

I hadn’t noticed the " that was missing though, thanks. I’ve now realised the src without an img tag worked because it was being recognised as an extension of the body tag

Thanks guys! That would have bugged me all night :slight_smile: