问题描述
|
我目前有一个看起来像这样的列表。
<li><a href=\"#\"><span class=\"short\">SHORT</span> <span class=\"long\">LONG</span></a></li>
我想将短跨度与右侧对齐,将长跨度与左侧对齐。
我目前的列表宽度为350px,并且长时间使用。
.long {
width: 300px;
position: absolute;
right: 0px;
}
似乎找不到找到使短跨度右对齐的方法。
解决方法
您是否尝试过使用
float
?
ul {
margin: 0;
padding: 0;
list-style: none;
width: 500px;
}
li {
list-style-type: none;
}
.long {
width: 300px;
float:left;
background-color: yellow;
}
.short {
width: 200px;
float:right;
background-color: green;
}