Sil*_*fer 0 html css twitter-bootstrap bootstrap-4
我试图用类垂直居中这个表的内容,align-middle
但它不起作用。我怎样才能让它工作?
tr, td, p, a {
border: 1px solid black;
}
Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<table class="table table-borderless">
<tbody>
<tr>
<td class="align-middle">
<p class="font-weight-bold font-italic text-secondary">LoremIpsum:</p>
</td>
<td class="align-middle">
<a href="#">Lorem ipsum</a>,
<a href="#">dolor sit amet</a>,
<a href="#">consectetur adipiscing</a>,
<a href="#">elit ultricies</a>
</td>
</tr>
<tr>
<td class="align-middle">
<p class="font-weight-bold font-italic text-secondary">Magna morbi sociis:</p>
</td>
<td class="align-middle">
<a href="#">Link</a>,
<a href="#">Link</a>
</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
如果您希望表格单元格显示为垂直对齐,则需要从段落 ( ) 中删除边距my-0
。
<td class="align-middle">
<p class="font-weight-bold font-italic text-secondary my-0">LoremIpsum:</p>
</td>
Run Code Online (Sandbox Code Playgroud)
https://www.codeply.com/go/MIWKNo9GQs
归档时间: |
|
查看次数: |
8724 次 |
最近记录: |