Search code examples
csspositioningcss-float

CSS: place div on the right of float:right


Hi stack overflow community. I have 2 dynamic divs that I want to float right inside a container. But I want the last div on the HTML to be more on the right than the first one. My problem is that I can't change the HTML, only CSS.

This will be used for navigation between pages, so I can have both divs visible or only one. Even if I only have one div, it has to be aligned to the right of the container (that's why I wanted to use floats).

Here's a jsfiddle for you to understand better: http://jsfiddle.net/Cthulhu/yVCDZ/1/

I want "Next" to appear after "Previous". Thanks in advance.


Solution

  • Instead of float, use display:inline-block; and set the container's text-align:right;

    I updated your fiddle: http://jsfiddle.net/mestekweb/yVCDZ/2/

    That should get you started, at least.

    ps - You will probably have problems with IE <8. I can offer some assistance there as well, if you need.