- This topic is empty.
-
AuthorPosts
-
October 8, 2012 at 6:31 am #40187
Sunny
MemberI have three divs first and second have width 60% and are floated left third has width 30% floated right.
IE7 works fine the third div appears from the top of the page. latest browsers floats element besides the 2nd div.I cannot change the order of the divs as its created through CMS.
and have access only to CSS.
Sample code looks like this
October 8, 2012 at 6:34 am #111394Sunny
MemberSorry sample code
[html]
[body]
[div style=”float:left; width:60%; height:100px; background:red”][/div]
[div style=”float:left; width:60%; height:100px; background:green”][/div]
[div style=”float:right; width:30%; height:100px; background:blue” position:relative; top:0][/div]
[/body[
[/html]I do not want the gap at the top and want the third div to start from the top of the page but on right side.
October 8, 2012 at 6:50 am #111397Sunny
MemberI want the first 2 divs to be below one another and only the third one to float to right
October 8, 2012 at 7:01 am #111395Paulie_D
MemberTry this.
October 8, 2012 at 7:16 am #111405Sunny
MemberThanks Paulie , but my bad… I should have explained the whole scenario.
Currently I am using position absolute to overcome this problem. However I have another major issue now with my right red div having so much content that its height exceeds beyond both left divs. This is fine, but I then have a footer below group div which overlaps the right red div in the middle of the page.October 8, 2012 at 7:24 am #111406Paulie_D
MemberIf you can’t change the order or content of the divs, you’re pretty much scr*wed then.
However, assuming that the left div heights aren’t going to change height though you could try something like this.
http://codepen.io/Paulie-D/pen/EIxgDNone of this is elegant. Sometimes though there is only so much you can do with CSS.
If the page HTML no longer fits the design, it’s time to change the HTML.
October 8, 2012 at 8:05 am #111407wolfcry911
ParticipantYour code above shows fixed height. Do any of the divs actually have a fixed height on the page (first or second div in particular)?
October 8, 2012 at 8:10 am #111408Paulie_D
MemberI assumed that was the case. I would be interested in seeing the actual page.
We might be trying to solve the wrong problem.
October 8, 2012 at 8:11 am #111409Sunny
MemberSorry, the heights are not fixed, but that was just used as a sample
the problem is that the combined height of 1st and 2nd div is less than the 3rd div which is positioned absolute.
October 8, 2012 at 8:13 am #111410Sunny
MemberAnyway thanks Paulie, the help is much appreciated.
October 9, 2012 at 5:39 am #111492Sunny
MemberI got a solution for this, so thought of putting it across, just in case if someone needs it later.
I removed the float for third div and gave a margin-left to it.
code sample below:
http://codepen.io/anon/pen/gBJyk -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.