Reputation: 5310
I have two divs. One should be positioned 5% from the left window border, the other should be to the right of the previously mentioned div and centred relative to window width. If the window is made too narrow it should not overlap the first div, and it should not move below either.
Whatever comes after should be positioned below the tallest of the first two divs.
How can I do this?
The closest I've come is to use a float for the first div. http://jsfiddle.net/7qVLm/
edit: Here's the final result that I'm happy with: http://jsfiddle.net/ATHpg/
Thanks to both @Christopher Smithson and @gmebeh whose answers helped me to get to this solution.
Upvotes: 0
Views: 258
Reputation: 2063
With percentage-based width
's you can make this happen:
#d1
is 5% from the left, center-aligned content#d2
is centered relative to the browser window, and will never overlap #d1
Play around with the percentages to get the exact width you you want.
Upvotes: 1