html - 如何在图标后对齐多行文本

标签 html css

在带有缩进(树数据)的表格中,我需要将第二行与第一行对齐。

注意,文本“Tail”与“Long”不对齐

enter image description here

在这里创建了一个类似的例子

div{
  width:400px;
}
<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>

最佳答案

您可以使用 display: table;display: table-cell;

div{
  width:400px;
  border: 1px solid black;
  display: table;
  padding: 10px;
}

a, span {
  display: table-cell;
  vertical-align: top;
}
<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>

关于html - 如何在图标后对齐多行文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34820524/

相关文章:

asp.net - 带有 IE8 问题的 ASP gridview 中的按钮

html - 两个内联 block 未对齐

python - 为什么 Enthought Canopy 推出没有样式 css 的 iPython Notebook html 文本?

javascript - 图像切换图库

javascript - 如何使用 Bootstrap-carousel lazy Multiple image SLide loader?

android - 图片标签在 Android 版 Chrome 上使用了错误的来源

IE7 中的 jquery 幻灯片问题

html - 消除表格 <td>s 垂直边框之间的间隙

javascript - 网站(HTML5、JavaScript)能否访问移动设备(android/iPhone)的联系人列表、SDCard 文件

css - 折叠时继续在导航栏上搜索