0

Im trying to have a right-aligned text with a border that starts where the text starts, on the left.

Problems :

  1. If I use a span, the border does not encapsulate multiple lines (border-top/bottom get messed up).
  2. If I use a span with inline-block, it kind of becomes similar to a div, the border on the left starts on the left side and not where the text starts.
  3. If I use a paragraph, it's just like a div as well.
  4. If I use a div, border is on the left as well.

Basically, what I would like is (where | is the left border):

    | Text

But I only manage to get :

|     Text
Adrien Gorrell
  • 1,291
  • 3
  • 14
  • 28

1 Answers1

0

Seems that inline-block inside a block might work. Or even simpler.

<div style="text-align: right">
  <div style="text-align: right; display:inline-block; border-left: 1px solid red;">
    some text<br> that spans two lines<br>
  </div>
</div>
IT goldman
  • 14,885
  • 2
  • 14
  • 28