+ 3
How do I make an image a background in my code?
I was trying to figure out how to put my image in the background of my HTML code. Can anyone help me? Example codes would be nice too. (:
8 Answers
+ 1
Yes, you can as Rahul Sahni said: background-image: url("linkoftheimage.com")
Or if you need just a color for background:
background-color: brown or just use color-picker for the hex codes like #008080
+ 2
Thanks!
+ 1
<html>
<body background="bgimage.jpg">
<h1>Hello world!</h1>
<p><a href="https://www.anywebsite.com">Click me</a>
</p>
</body>
</html>
+ 1
So I just add âbackgroundâ to the body tag? No need to change the closing tag?
+ 1
body{
background-image:url("http://website.com");
}
+ 1
Thanks so much that worked!
0
no it is not required...
0
one more question... can you make a background in CSS?