如何将多行数据以分组的形式对齐到单元格的上,中或下位置

将多行数据显示在一个单元格中,然后使用vertical-align,将他们自动对齐到单元格的上边,中间或下边。

 1 <!DOCTYPE html>
 2 <html>
 3 <head lang="en">
 4     <meta charset="UTF-8">
 5     <title></title>
 6     <style>
 7         .align-top{height: 200px;vertical-align:top; }
 8         .align-middle{height: 200px;vertical-align: middle;}
 9         .align-bottom{height: 200px;vertical-align: bottom;}
10     </style>
11 
12 </head>
13 <body>
14 <h1>Verticla-aligned Data</h1>
15 <table>
16     <tr>
17         <td class="align-top">These lines of text are vertically aligned to the top of the cell</td>
18         <td class="align-middle">These lines of text are vertically aligned to the middle of the cell</td>
19         <td class="align-bottom">These lines of text are vertically aligned to the bottom of the cell</td>
20     </tr>
21 </table>
22 
23 
24 </body>
25 </html>

 可以利用display:table,  display:table-row和display:table-cell规则,可以将元素转化为表格,行和单元格~ 

转载于:https://www.cnblogs.com/s-z-y/p/4475874.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值