html - Div 高度属性在 Chrome 中无法正常工作

标签 html css height

在我的 mvc 应用程序中,我添加了一个 divheight:270px

<style type="text/css">
    .table-div {
        height: 270px;
        margin-top: -20px;
        border-top: 2px solid #DDD;
        border-bottom: 2px solid #DDD;
        margin-right: 10px;
        margin-left: 10px;
        background-color: white;
    }
</style>

它在 firefox 中运行良好。但是如果我在 Chrome 中打开它,那么它的高度看起来会超过 270px。为什么会这样?如何解决?

最佳答案

可能是元素 height.border-top 和 border-bottom 应该加上 270。

关于html - Div 高度属性在 Chrome 中无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36446634/

相关文章:

css - div 未正确对齐

html - CSS3 布局 - 4 列多边形

javascript - 预加载内容与 Ad-Hoc

java - 如何通过电子邮件发送嵌入图像的 HTML 报告(作为附件)?

javascript - 将 svg 图像的 Base 64 定义移动到外部文件中

javascript - 在单独的表格中按类别或 ID 突出显示 2 行

jQuery.addClass 不工作

css - 堆叠式 flex 盒垂直居中在 Chrome 中不起作用

jquery - 如何设置已动态添加到页面的元素的高度

css - Div 未调整大小以适合内容