Reputation: 83
I am learning how to create a website and I have stumbled upon a problem I can't figure out. I want to place a banner on the top of every webpage page of the site, and I was wondering if this can be done using a .CSS. I have a background already on the .CSS but I can't seem to insert a picture properly on top. This is my code:
hr {color:sienna;}
p {margin-left:20px;}
body {
background-image:url("pic2.png");
}
And then I would call it on every page like (the css file name is style.css):
<link rel="stylesheet" type="text/css" href="style.css">
Upvotes: 2
Views: 55332
Reputation: 3750
<div id="banner"></div>
<div id="content">
Hello world
</div>
#banner {
background:url('http://sweetclipart.com/multisite/sweetclipart/files/imagecache/middle/banner_white.png');
width:100%;
min-height:189px;
}
Or do you want it to dynamically apply the element to your page?
For further insight, we need more data:
If you are trying to actually add elements to your page, CSS only allows to perform pseudo operations
with existing elements on your page.
Upvotes: 3
Reputation: 2548
I found one syntax error in you codes.
you can use only either use
background-image:url("pic2.png");
background-repeat:repeat;
or
background:url("pic2.png") repeat;
Upvotes: 1