html - Right Align an Element in CSS While Maintaining Document Flow -
is possible right align element in css without removing document flow?
for instance,
position:absolute; right:0;
would right align element, element removed document flow. likewise, float:right;
mess layout. possible right align element position:relative
? or there other way of right aligning elements easily?
i'm asking because need use right:
set position of element on javascript events, need take space elements underneath don't need manually positioned hand.
apply display: inline-block;
, wrap element text-align: right;
on it.
.right-container { text-align: right; } .align-right { display: inline-block; width: 50px; height: 50px; background-color: green; }
<div class="right-container"><div class="align-right"></div></div> <div class="some-text">some text text text text text text text text</div>
Comments
Post a Comment