我的结构如下:
<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;
}
我希望.player-godziny跨越右边。为什么不起作用?
这是一个小提琴:http://jsfiddle.net/wL2SF/
答案 0 :(得分:7)
答案 1 :(得分:3)
您需要添加float:right;
<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*/
}
答案 2 :(得分:2)
尝试:
.player-godziny {
float: right;
color: #5ACFC9;
}