- This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hey, I have a div with a background, but I want the background just on the half of the div. how can I do it? (without any other div)
If you know the height of the background, you can use background-position to adjust it. So, if the background has a height of 500px, you could do this:
div { background-position: 0 -250px; }
It’s right, but if I want that the background (for example 2px X 2px) will be duplicated just on the half div (for example the width of the div is 500px and I need just on 250px). thank you.
So you want it split horizontally? Then just switch the numbers around…
My fault sorry, I mean if I don’t know the size of the div.. there is a way to do it?
Oooohhh I see what you mean. I think that would need some multi-div activity, or some sort of JS solution.
well multi div might work better, make a main div wrapping two divs, give the two inner divs z values. one of those divs is going to be the background so use width:50% in the css for the div then set the background image for this dive and set it to repeat as you wish through the whole div. The other div will hold your content. I believe that should work :D someone correct me if I’m wrong :D
Without knowing what you want to use it for or how exactly it affects your site, its hard to visualize the solution you’re looking for, so sorry if i totally missed your point.