html - table 不会达到 100% 高度

标签 html css

我正在创建一个在一个表中包含 2 个表的页面,我遇到的问题是我的一个表没有 100%,我创建了一个 jsfiddle 供您查看,而那个是问题是那个有粉红色背景的。 此问题只出现在 Chrome、Safari 和 IE 中,但在 Firefox 中工作正常。

我的html

<table class="table company_table_wrapper">
    <tbody>
        <tr>
            <td class="company_table" height="100%">
                <table class="table table_unit" style="height:100%">
                    <tbody>
                        <tr>
                            <td colspan="3">
                                <div class="company_title">
                                    <h2>This is the head of units</h2>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="unit_heads">
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: bold;">Testing</span>
                                    </p>
                                    <p>
                                        <span style="color: #00316f; font-size: 13px; font-weight: 600;">Person 1</span>
                                    </p>
                                    <p>
                                        <span style="font-size: 13px; font-weight: 300;">Tel number</span>
                                    </p>
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: 300;">
                                            <a href="mailto:info@info.net" style="color: #6197dc;">info@info.net</a>
                                        </span>
                                    </p>
                                </div>
                            </td>
                            <td>
                                <div class="unit_heads">
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: bold;">Testing 2</span>
                                    </p>
                                    <p>
                                        <span style="color: #00316f; font-size: 13px; font-weight: 600;">Person 2</span>
                                    </p>
                                    <p>
                                        <span style="font-size: 13px; font-weight: 300;">Tel number</span>
                                    </p>
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: 300;">
                                            <a href="mailto:info@info.net" style="color: #6197dc;">info@info.net</a>
                                        </span>
                                    </p>
                                </div>
                            </td>
                            <td>
                                <div class="unit_heads">
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: bold;">Testing 3</span>
                                    </p>
                                    <p>
                                        <span style="color: #00316f; font-size: 13px; font-weight: 600;">Person 3</span>
                                    </p>
                                    <p>
                                        <span style="font-size: 13px; font-weight: 300;">Tel number</span>
                                    </p>
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: 300;">
                                            <a href="mailto:info@info.net" style="color: #6197dc;">info@info.net</a>
                                        </span>
                                    </p>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="unit_heads">
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: bold;">Testing 4</span>
                                    </p>
                                    <p>
                                        <span style="color: #00316f; font-size: 13px; font-weight: 600;">Person 4</span>
                                    </p>
                                    <p>
                                        <span style="font-size: 13px; font-weight: 300;">Tel no</span>
                                    </p>
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: 300;">
                                            <a href="mailto:info@info.net" style="color: #6197dc;">info@info.net</a>
                                        </span>
                                    </p>
                                </div>
                            </td>
                            <td>
                                <div class="unit_heads">
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: bold;">Testing 5</span>
                                    </p>
                                    <p>
                                        <span style="color: #00316f; font-size: 13px; font-weight: 600;">Person 5</span>
                                    </p>
                                    <p>
                                        <span style="font-size: 13px; font-weight: 300;">Tel no</span>
                                    </p>
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: 300;">
                                            <a href="mailto:info@info.net" style="color: #6197dc;">info@info.net</a>
                                        </span>
                                    </p>
                                </div>
                            </td>
                            <td>
                                <div class="unit_heads">
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: bold;">Testing 6</span>
                                    </p>
                                    <p>
                                        <span style="color: #00316f; font-size: 13px; font-weight: 600;">Person 6</span>
                                    </p>
                                    <p>
                                        <span style="font-size: 13px; font-weight: 300;">Tel no</span>
                                    </p>
                                    <p>
                                        <span style="color: #6197dc; font-size: 13px; font-weight: 300;">
                                            <a href="mailto:info@info.net" style="color: #6197dc;">info@info.net</a>
                                        </span>
                                    </p>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
            <td class="join_table_wrapper" height="100%">
                <table class="table table_join_us" style="height:100%">
                    <tbody>
                        <tr>
                            <td>
                                <div class="join_us">
                                    <div class="join_us_title">
                                        <h2>Join Us!</h2>
                                        <img src="images/magnify_glass.png">
                                        <div class="clearboth"></div>
                                    </div>
                                    <div class="join_us_content">
                                        <p>Some content goes here</p>
                                        <p>
                                            More content goes here
                                            <a href="info@info.net">info@info.net</a>
                                        </p>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>

这是一个 jsfiddle:JSFIDDLE

最佳答案

display: inline-table;

在持有第二张 table 的 td 上。

参见:http://jsfiddle.net/Lhx14tvk/1/

关于html - table 不会达到 100% 高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29770702/

相关文章:

html - Img 在导航中间

html - 垂直对齐 div 后,JQuery 全屏背景不起作用

javascript - HTML <select> 选中的选项 background-color CSS 样式

javascript - 使用 CSS 将表情符号文本替换为图像

html - 如何使用html和css在页面上制作幻灯片

javascript - 为什么我的非 Canvas 菜单在打开时将我的固定 div 推出框架?

html - IE11 - border-radius 和 box-shadow 一起导致问题

html - 根据内容动态调整 css 网格列的高度

html - 有没有办法禁用下拉菜单的文本?

javascript - 添加后无法滚动