float: right
is perfectly okay applied to all elements, block-level or inline it doesn't matter, either semantically or according to the spec (so far as I'm aware).
If you want to right-align something without using float
then there's the possibility of margin-right: 90%;
(assuming you know that what it's right-aligned from/against fits into the other 10%.
Or direction: rtl;
but that never works like I think it should, plus it'd likely complicate things.
position: absolute; right: 0;
would do as you need (but it'd be removed from the document's flow, and it would be positioned against the first of its parent elements that has a defined position: relative;
(or at least defined position
).
You could, possibly, use text-align: right
, but that seems like such a simple solution that I'm sure you'll have already tried it.
If you could provide a use-case, some code and an indication of your expected end-result we might be able to help you more.