2

I used the following solution to float a inner-div (corner) to the top right corner of a outer-div (base). That works great.

CSS:

#base {width: 100px; height: 100px;}
#corner {float: right; width: 40px; height: 40px; margin: 0 0 15px 15px;}

HTML:

<div id="base">
    <div id="corner">
        <!--stuff inside corner-->
    </div>
    <!--other stuff inside base-->
</div>

Now I want to float the inner-div (corner) to the bottom of the outer base-div (bottom right), but I'm unable to find the correct css configuration. What do I have to change to reach my goal?

It's quite important, that the text of the base div floats the corner-div (as in the example above).

2 Answers2

2

Make the container div position: relative. Then, use position: absolute in the div that you want to "float" (but you don't need to use float) and set bottom and right rules to 0.

http://jsfiddle.net/ExplosionPIlls/yWGTB/

Explosion Pills
  • 188,624
  • 52
  • 326
  • 405
2

try positionning your divs

#base {
    width: 100px;
    height: 100px;
        /* positionning */
    position:relative;
}

#corner {
    /* float: right; */ /*floating will be useless */
    width: 40px;
    height: 40px;
    margin: 0 0 15px 15px;
        /* positionning */
    position:absolute;
    bottom:0;
    right:0;
}

Now, if you need your outter div content to FLOAT around inner-bottom-corner div, you will have to 'TRICK' your layout, simulating an empty space UNDER the inner-bottom-corner

Further infos :

Community
  • 1
  • 1
Milche Patern
  • 19,632
  • 6
  • 35
  • 52