简体   繁体   English

在表格单元格中垂直对齐文本

[英]Vertically Align Text in a Table Cell

I'm having difficulty in vertically aligning this pricing table's "Team" "Business" etc H4 headings in their respective table cells. 我在各个表单元格中垂直对齐此定价表的“团队”,“业务”等H4标题时遇到困难。

The table is a fairly simple one without too many styles applied so I am not sure what I am doing wrong here. 该表是一个相当简单的表,没有应用太多样式,因此我不确定在这里做错了什么。 I have tried wrapping text in a div and setting the parent div's width and height to 100%. 我尝试将文本包装在div中并将父div的宽度和高度设置为100%。 It didn't work. 没用

This is the link for the practice website where I am working: https://netterrain-new-features-clone.mystagingwebsite.com/network-documentation-pricing/ 这是我正在工作的练习网站的链接: https : //netterrain-new-features-clone.mystagingwebsite.com/network-documentation-pricing/

Note: It's better to give code(not working) rather than webpages 注意:最好提供代码(不起作用)而不是网页

Try adding following styles 尝试添加以下样式

table th, table td{
   display: table-cell;
   vertical-align: middle;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM