具有两个跨度的列表项左右对齐

问题描述

| 我目前有一个看起来像这样的列表。
<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;   
}
    

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...