• TEST TEXT

    CSS Align the area to the right of the list?

    HTML

    <ul class="list-group">
        <li class="list-group-item normal-row">TEST TEXT <span class="cross">✘</span></li>
        <li class="list-group-item normal-row">TEST TEXT <span class="rtr_symbolcross"><span class="tick">βœ”</span></li>
        <li class="list-group-item normal-row">TEST TEXT TEST TEXT TEST TEXT<span class="cross">✘</span></li>
        <li class="list-group-item normal-row">TEST TEXT TEST TEXT<span class="tick">βœ”</span></li>
    </ul>
    

    CSS

    .tick {
        text-align: right;
    }
    .cross {
        text-align: right;
    }
    

    https://jsfiddle.net/ewgp3oxL/

    How can I do the above, look like this:

    enter image description here

    So, as you can see, ticks and crosses are completely right, the css I tried does nothing for: S

    I use span because I also apply color, background color, font size, font size, shadow ... and some other things.

    +4
    source share
    6 answers

    Change the position of the range to absolute and right to 0px.

    Here you can change the space between the cross / tick and the text.

    li{
        position:relative;
        width:600px;
    }
    .cross, .tick {
        position:absolute;
        right:0px;
    }
    

    Jsfidle

    +3
    source

    Use float instead of text-align

    .tick {
        float: right;
        clear: both;
    }
    .cross {
        float: right;
        clear: both;
    }
    

    Working fiddle - https://jsfiddle.net/1xmxncLr/

    +3
    source

    flexbox.

    li {
      display: flex;
      justify-content: space-between;
    }
    <ul class="list-group">
      <li class="list-group-item normal-row">TEST TEXT <span class="cross">✘</span>
      </li>
      <li class="list-group-item normal-row">TEST TEXT <span class="rtr_symbolcross"><span class="tick">βœ”</span>
      </li>
      <li class="list-group-item normal-row">TEST TEXT TEST TEXT TEST TEXT<span class="cross">✘</span>
      </li>
      <li class="list-group-item normal-row">TEST TEXT TEST TEXT<span class="tick">βœ”</span>
      </li>
    </ul>
    Hide result
    +2

    text-align , , , , , .

    Flexbox , , Paulie_D , , :

    li{
      position:relative;
    }
    span{
      position:absolute;
      right:0;
      top:0;
    }
    <ul>
      <li>TEST TEXT <span>✘</span></li>
      <li>TEST TEXT <span>βœ”</span></li>
      <li>TEST TEXT TEST TEXT TEST TEXT<span>✘</span></li>
      <li>TEST TEXT TEST TEXT<span>βœ”</span></li>
    </ul>
    Hide result
    0

    td text-align: right

    0

    , , :

    .tick {
        position: fixed;
        right: 0; }
    .cross {
        position: fixed;
        right: 0; }
    
    -3

    Source: https://habr.com/ru/post/1617984/


    All Articles