我想你正在寻找这样的东西:
html
<div>
<div>Marinated Olives</div>
<div class="dot"></div>
<div>4.00E</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.dot{
border-bottom: dotted 3px orange;
width: 100px;
float: left;
position: relative;
display: block;
height: 12px;
margin: 0 5px 0 5px;
}
div:first-child, div:last-child{
float:left;
}
Run Code Online (Sandbox Code Playgroud)
您可以根据自己的喜好调整宽度。
还有另一种使用CSS的方法:after
html
<div>
<div id="dotted">Marinated Olives</div>
<div>4.00E</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
div{
float:left;
}
#dotted::after{
content: "..................";
letter-spacing: 4px;
font-size: 18px;
color:orange;
margin-left:20px;
}
Run Code Online (Sandbox Code Playgroud)
在这里您可以调整内容和字母间距。希望能帮助到你 :)
小智 0
您可以使用此代码来生成该行:
#helper{
width:200px;
border: 1px dashed orange;
}
Run Code Online (Sandbox Code Playgroud)
来源: http: //jsfiddle.net/2j9BN/