设置要显示的表:块 [英] Setting a table to display: block

查看:93
本文介绍了设置要显示的表:块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢让我的表表现得像一个块元素.我不能将其设置为width:100%,因为它确实有一些填充,这将导致100%+填充PX.

I like to get my table behave like a block element. I cannot set it to width:100% because it does have some padding, this is going to result 100% + the paddings PX.

签出: http://jsfiddle.net/LScqQ

最后,桌子做了我想要的,您能看到盒子阴影吗?但是桌上的孩子不喜欢这样^^

Finally the table does what I want, can you see the box-shadow? But the table children don't like it that way^^

我想THEAD里面的TH是问题所在. 他们没有获得66%到33%的长宽比.

I guess the TH inside the THEAD are the problem. They do not get the aspected ratio of 66% to 33%.

需要帮助...

推荐答案

最后,我自己找到了答案.

Finally I found the answer by myself.

将表放入包装容器中,并编写类似于以下内容的CSS规则:

Put your table inside a wrapper container and write a CSS rule similar to this:

//HTML

<div class="wrapper-table">
<table>...</table>
</div>

//CSS

.wrapper-table > table
{
    width: 100%;
}

现在,表格将不再溢出您的布局,并且非常适合大多数元素.

Now the table will no longer overflow your layout and fits perfectly like most elements do.

这篇关于设置要显示的表:块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆