I've been looking at this for the past days now and I'm at the point where I need to ask for help.
http://cub.northnodes.com/index.php/about/mission/
I need the donate now column to float all the way to the right, but it only goes halfway. I can't figure out why it's stopping there, there's no containing div that ends there. I've tried to take it out of the #center
div, and have placed it both before it with no better results. Placing it after the #center
div makes it float left all the way beautifully, but below the #center
where I don't want it to be.
The trick is to apply overflow: auto to the div , which starts a new block formatting context. The result is that the floated button is enclosed within the block area defined by the div tag. You can then add margins to the button if needed to adjust your styling.
If you want to align a <span> element to the right of the <div>, you can use some CSS. Particularly, you need to use the float property with the “right” and “left” values.
The elements after the floating element will flow around it. The elements before the floating element will not be affected. If the image floated to the right, the texts flow around it, to the left and if the image floated to the left, the text flows around it, to the right.
If you want to move the button to the right, you can also place the button within a <div> element and add the text-align property with its "right" value to the "align-right" class of the <div>.
In case others come later:
I had a similar issue where float right would only move halfway across its containing div
. Neither it, its siblings, or container had position relative. However, the containing div
's prior sibling also had a child with a float: right;
(coincidence that it was the last child; not sure?). I solved my problem by adding a clear: both;
to the div
containing the offending floater. This was on Chrome.
This happened to me because I had set max-width
on a parent container. I removed that and my element floated all the way to the right properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With