Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Align Span to right of list?

Tags:

css

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 make the above, look like:

enter image description here

So as you can see the ticks and crosses are all the way over at the right hand side, the css that I've tried does nothing to :S

I'm using a span because I also apply color, background color, font-size, font-weight, shadow... and some other stuff.

like image 204
Ryflex Avatar asked Nov 30 '15 12:11

Ryflex


People also ask

How do I move a span to the right in CSS?

If you want to align a <span> element to the right of the <div>, you can use some CSS. Particularly, you need to use the float property with the “right” and “left” values.

How do you right align a list in CSS?

To make a right-aligned version of the list, only three changes need to occur. First, set the "UL" "text-align" to "right". Second, change the left "background-position" from "0" to "100%" - which makes the image align up with the right edge. And finally change "padding-left" to "padding-right".

How do you align items in a span?

Text Align To center an inline element like a link or a span or an img, all you need is text-align: center . For multiple inline elements, the process is similar. It's possible by using text-align: center .

How do I move a span to the next line in CSS?

Pressing alt+shift+f on an HTML type document with a span next to a single quote forces the span onto a new line. Create a new document.


1 Answers

Change span position 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

like image 82
Alexis Avatar answered Nov 15 '22 07:11

Alexis