答案 0 :(得分:0)
Flexbox可以做到这一点:
ul {
list-style-type: none;
width: 90%;
margin: auto;
padding: 0;
}
.list {
display: flex;
align-items: flex-end;
margin-bottom: .5em;
}
.first {
margin-right: 0.5em;
color: #2B91AF;
flex: 1;
display: flex;
align-items: flex-end;
}
.price {
text-align: right;
flex: 0 0 4em;
}
.first:after {
content: '';
height: 1px;
border-bottom: dashed 1px tomato;
flex:1;
}

<ul>
<li class="list">
<i class='first'>Porterhouse <br/>Steak:</i>
<i class="price">$150.00</i>
</li>
<li class="list">
<i class='first'>Baked Potato:</i>
<i class="price"> $5.00</i>
</li>
<li class="list">
<i class='first'>Side Salad</i>
<i class="price"> $25.00</i>
</li>
<li class="list">
<i class='first'>Soft Drink</i>
<i class="price"> $10.00</i>
</li>
</ul>
&#13;
答案 1 :(得分:0)
Sandrina的解决方案非常好,但我只用
解决了我的问题显示:直列重要
答案 2 :(得分:-1)
Flexbox不是最好的选择,因为它支持旧浏览器和safari / firefox上的一些bug ...
我会将:after
移至li
而不是<p>
li:after {
content: " ";
height: 1px; /*never use 0.x px. there is no "half pixels", NEVER.*/
display: block;
bottom: 0; /* make sure align to bottom */
/* top: -13px; */
/* background: #f26622; a line is better*/
border-bottom: 1px dashed #f26622; /* your fancy dashed line*/
width: 100%;
position: relative;
}