Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS float creating white space

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #40187
    Sunny
    Member

    I 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


    #111394
    Sunny
    Member

    Sorry 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.

    #111397
    Sunny
    Member

    I want the first 2 divs to be below one another and only the third one to float to right

    #111395
    Paulie_D
    Member
    #111405
    Sunny
    Member

    Thanks 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.

    #111406
    Paulie_D
    Member

    If 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/EIxgD

    None 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.

    #111407
    wolfcry911
    Participant

    Your code above shows fixed height. Do any of the divs actually have a fixed height on the page (first or second div in particular)?

    #111408
    Paulie_D
    Member

    I assumed that was the case. I would be interested in seeing the actual page.

    We might be trying to solve the wrong problem.

    #111409
    Sunny
    Member

    Sorry, 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.

    #111410
    Sunny
    Member

    Anyway thanks Paulie, the help is much appreciated.

    #111492
    Sunny
    Member

    I 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

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘CSS’ is closed to new topics and replies.