在具有缩进(树数据)的表中,我需要将第二行与第一行对齐.
注意,文字"Tail"与"Long"不对齐
这里创建了一个类似的例子
div{
width:400px;
}Run Code Online (Sandbox Code Playgroud)
<div>
<a href="">ICon:</a>
<span>This is my fight song. Take back my life song. Prove I'm alright song. My power's turned on
Starting right now I'll be strong</span>
</div>Run Code Online (Sandbox Code Playgroud)
你可以用display: table;和做display: table-cell;
div{
width:400px;
border: 1px solid black;
display: table;
padding: 10px;
}
a, span {
display: table-cell;
vertical-align: top;
}Run Code Online (Sandbox Code Playgroud)
<div>
<a href="">ICon:</a>
<span>This is my fight song. Take back my life song. Prove I'm alright song. My power's turned on
Starting right now I'll be strong</span>
</div>Run Code Online (Sandbox Code Playgroud)