Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

text-align: right on a span inside li tag

my structure looks like this:

<ul class="grupa-playerow">Blabla
    <li class="player-li">Layout1<span class="player-godziny">15.00-17.00</span></li>
    <li class="player-li">Layout2<span class="player-godziny">17.00-22.00</span></li>
    <li class="player-li">Layout3<span class="player-godziny">22.00-24.00</span></li>
</ul>

and here goes the style:

.grupa-playerow {
position: relative;
width: 300px;
list-style-type: none;
padding: 7px 0 7px 0;
border-bottom: 1px solid #CDCDCD;
font-size: 11px;
cursor: pointer;
}


.player-li {
padding: 2px 0 2px 20px;
width: 100%;
text-align: left;
}

.player-godziny {
text-align: right !important;
color: #5ACFC9;
}

I would like .player-godziny span to align to the right. Why isn't it working?

Here's a fiddle: http://jsfiddle.net/wL2SF/

like image 437
user3691280 Avatar asked Jul 17 '14 13:07

user3691280


3 Answers

Try:

float: right;

instead of:

text-align: right;

JSFiddle

If you notice alignment issues, they are likely resulting from your padding settings

like image 107
JRulle Avatar answered Sep 17 '22 21:09

JRulle


you need add float:right;

DEMO

<ul class="grupa-playerow">Blabla
    <li class="player-li">Layout1<span class="player-godziny">15.00-17.00</span></li>
    <li class="player-li">Layout2<span class="player-godziny">17.00-22.00</span></li>
    <li class="player-li">Layout3<span class="player-godziny">22.00-24.00</span></li>
</ul>

.grupa-playerow {
position: relative;
width: 300px;
list-style-type: none;
padding: 7px 0 7px 0;
border-bottom: 1px solid #CDCDCD;
font-size: 11px;
cursor: pointer;
}


.player-li {
padding: 2px 0 2px 20px;
width: 100%;
text-align: left;
}

.player-godziny {
text-align: right !important;
color: #5ACFC9;
  float:right;/*ADD*/
}
like image 24
Alex Wilson Avatar answered Sep 19 '22 21:09

Alex Wilson


Try:

.player-godziny {
float: right;
color: #5ACFC9;
}
like image 44
mmatus Avatar answered Sep 17 '22 21:09

mmatus