[英]How do I make my inline-block table expand to 100% width?
This is my code below and I'm trying to make it look like this image: 这是下面的代码,我试图使其看起来像此图像:
I'm unsure of how to expand the table header all the way to the right. 我不确定如何将表头一直扩展到右边。 I also don't know how to add more spacing between the bottom border.
我也不知道如何在底部边框之间添加更多间距。
For the lazy my code shows this: 对于懒惰的我的代码显示如下:
font-family:Arial; font-size:12px; width:800px; } table { border-style: solid; border-color: #cfdaf1; border-width: 1px; border-collapse: collapse; } th { text-align: left; background-color: #cfdaf1; padding: 3px; } td { padding: 10px } #headerMenu { display: inline-block; height: 125px; padding: 5px; border-top: 1px solid black; border-bottom: 1px solid black; } #contactTable { display: inline-block; padding: 3px; margin-bottom: 1px; } #tableHeader { display: inline-block; padding: 3px; margin: 5px; } #ul { list-style: none; padding: 0px; } #ul li:before { content: '►'; margin: 0 1em; }
<table id="tableHeader" width="100%"> <tr> <th style="border-bottom: 1px solid black;">Key Skills</th> </tr> <tr> <td>This is a main summary of my skills.</td> </tr> <tr> <td> <ul id="ul" style="list-style-type: none"> <li>Negotiating (Intermediate)</li> <li>Access (Beginner)</li> <li>Accounting (Beginner)</li> <li>Sales Auditing (Expert)</li> <li>Invoicing (Intermediate)</li> </ul> </td> </tr> </table>
I don't think using a table
and set it's display: inline-block
is a good idea, revise it with display: table; width: 100%
我不认为使用
table
并将其设置为display: inline-block
是一个好主意,请使用display: table; width: 100%
对其进行修改display: table; width: 100%
display: table; width: 100%
in CSS should make it fill the width, also I would wrap it inside a <div class="container">
for better CSS maintenance display: table; width: 100%
CSS中的display: table; width: 100%
应该填充宽度,我也将其包裹在<div class="container">
以更好地维护CSS
See the example: https://jsfiddle.net/Zay_DEV/a5zwgjz3/ 参见示例: https : //jsfiddle.net/Zay_DEV/a5zwgjz3/
This example should implemented what all you want: https://jsfiddle.net/Zay_DEV/a5zwgjz3/2/ 这个例子应该实现你想要的一切: https : //jsfiddle.net/Zay_DEV/a5zwgjz3/2/
If you prefer a cleaner and tableless version, but still using display: flex;
如果您希望使用更干净,没有桌面的版本,但仍使用
display: flex;
: follows: https://jsfiddle.net/vowpzf47/ :如下: https : //jsfiddle.net/vowpzf47/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.