css - How to get these timestamps, which come after in the html, to float right on the same line -
i have markup, can't change, looks this:
<div class="message"> <p class="messagetext">long long long long long long long long long message wraps</p> <span class="timestamp">6:30:07 pm</span> </div> <div class="message"> ...
how can style css this?:
long long long long long long 6:30:07 pm long long long message wraps next message 6:31:58 pm
i want timestamps go on over right, directly right of message correspond to.
if timestamps appeared before messages in markup, float them right , work fine. how do in case, given appear after messages?
assuming these timestamps consist of same amount of characters, , therefor have (roughly) same width, positioning them absolutely easy solution:
.message { position:relative; padding-right:5em; } .timestamp { position:absolute; top:0; right:0; }
https://jsfiddle.net/pao17yeb/
the padding-right
“reserves” space message text can’t flow into, it’ll wrap before.
should not possible, using flexbox reverse display order of items might alternative way go this.
Comments
Post a Comment