cssalignmentright-justified

CSS - shift long continuous text inside the div to the right?


I have a long text that would not fit within the div it occupies. The div class is as follows:

.mydiv {
    overflow:hidden;
    padding:3px 3px 3px 5px;
    white-space:nowrap;
}

Of course I can only see portion of text. The problem is that it shows first N characters and I want to show last N chars. How do I achieve it with CSS? Text-align doesn't help here.


Solution

  • If you're able to wrap your text in another element, you can make it work as shown in this fiddle. I've floated a nested <span> to the right.