Consider the following jsFiddle: http://jsfiddle.net/mark69_fnd/yqdJG/1/
HTML:
<div id="container">
<div class="char">
AAA
</div>
<div class="char stickToRight">
BBB
</div>
</div>
CSS:
#container {
border:solid 2px green
}
.char {
display: inline-block;
border: solid 2px red;
}
.stickToRight {
float: right
}
Is there another way to make .stickToRight
be aligned right, without floating it?
I need to keep it as display:inline-block
so that I can make its vertical alignment consistent with other .char
elements.
How can I achieve the float:right
right-alignment effect, whilst keeping the element display:inline-block
? (Note that I do not know the width of the container element.)
I'd like purely CSS solutions, if there are any.