zmanc zmanc - 1 year ago 123
CSS Question

Right Side align without float

I have a chat widget that I am adding some styling to. However I am having difficulty making the "user" chat bubbles align to the right of the screen.

When I use float right, with float left(for the other side) the divs no longer position correctly, in that they seem to just go to the right of the relative divs.

I would like it to also be able to append div's that will cause the overflow-y to create a scroll bar. Which without the float is already working as expected.

Below is the current version in a jsbin.

TLDR; trying to get the .chat-bubble-user divs to align to right of screen without float.

Answer Source

if you don't want use floats, just try with inline-block, like so:

#chatWindow {
   text-align: right;

.chat-bubble-user {
   display: inline-block;
   text-align: left; 

JsBin (tested on Fx20):

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download