css text-indent equivalent on the right side

前端 未结 6 914
醉话见心
醉话见心 2020-12-31 02:27

I have right-side aligned text and I want it to push it a little bit left like you do with text-indent bur on the right side. Any solution with that? I\'ve been trying with

相关标签:
6条回答
  • 2020-12-31 03:06

    Do the following

    text-indent: 60px;
    direction: rtl;
    text-align: left;
    

    f.ardelian pointed out: Punctuation will appear at the beginning of the line so abc. will appear .abc

    0 讨论(0)
  • 2020-12-31 03:10

    What I did and worked for me was this:

    text-indent: 20px;
    padding-right: 40px;
    
    0 讨论(0)
  • 2020-12-31 03:13

    There is none, unfortunately there is no text outdent in css, hower, you could use text direction direction:rtl; for some short texts, in that way indent will appear on the other side.

    0 讨论(0)
  • 2020-12-31 03:18

    CSS only solution, does not mess with text direction (SEO and translation friendly?), no floats, no additional elements, width of post-indent is easy to modify:

    &::after {
        content: "\0000a0";
        height: 1em;
        letter-spacing: 1rem;
    }
    
    0 讨论(0)
  • 2020-12-31 03:19

    I would need to see your code however a solution to your problem with old browsers is to include an empty span and apply a width:

    <style>
    span.right-adjust {
      display:inline-block;
      width:5px;
    }
    </style>
    
    <div>Your text here<span class="right-adjust"></span></div>
    

    It is hard to tell what you want without providing us with code. You could also apply a float:right;

    There are many ways to solve issues with old browsers and CSS.

    Hope this helps

    0 讨论(0)
  • 2020-12-31 03:25

    Simple solution is to apply a "before" CSS style to your text element which negates all side effects of direction: rtl;

    &:before {
          content: ' ';
          width: 100px;
          float: right;
          height: 5px;
    } 
    
    0 讨论(0)
提交回复
热议问题