Reputation: 4356
I have a div with these properties
#content {
background-image: url('img/cbg.png');
background-position: center top;
background-repeat: repeat-y;
width: 960px;
margin: auto;
padding-bottom:50px;
margin-bottom: 20px;
}
The background only shows up for 70px (I think) and then stops, then the rest of the stuff inside the div just goes on down the page like normal. If I set display:inline-block, it works correctly but uncenters my div.
Upvotes: 0
Views: 94
Reputation: 77278
If you have elements in the container which are floating, it's possible that the floats aren't properly being cleared. If this is your problem there are a bunch of work-arounds - they're called "clearfixs".
One of my favorite write-ups was here. The css they used in this example was here.
div.container {
border: 1px solid #000000;
overflow: hidden;
width: 100%;
}
div.left {
width: 45%;
float: left;
}
div.right {
width: 45%;
float: right;
}
Upvotes: 1
Reputation:
It wouldn't expand any longer because you have set your #content
width to 960px in your browser window.
In the case of your image expanding only up to 70px
, it is probably because that's the actual height
of the image you've used. but mistakenly used repeat-y
(repeat vertically).
Here's a simple concept in background-repeat
:
Upvotes: 0
Reputation: 77956
Well, you're doing repeat-y
which means it'll only repeat vertically. If the background image is 70px, that would support the issue. Either use repeat-x
or just repeat
.
Upvotes: 0