为什么 min-height 在 Safari 和 Firefox 中的 table 上不起作用?

Why is min-height not working on my table in Safari and Firefox?

该站点在 Chrome 和 Edge 上正常运行,但在 Firefox 和 Safari 上被压缩。

这是一个有效的 JSFiddle

这是一张显示顶部 - Safari 和底部 - Chrome 之间的比较的图片。它应该看起来像底部的那个。

.spell span {
    position: relative;
    top: 25%;
}
.note {
    clear: both;
}
.spell {
    text-align: center;
    max-width: 100%;
    height: 35px;
    background-color: #E7E7E7;
}
.BUFF {
    background-color: #80DE57;
}
.NERF {
    background-color: #DE5B54;
}
.CHANGE {
    background-color: #D2A557;
}
.NEW {
    background-color: #50B9EB;
}
.BUGFIX {
    background-color: rgb(141, 141, 141);
}
.change_icon {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
    color: white;
    vertical-align: middle;
    text-align: center;
    min-width: 70px;
    height: 100%;
    display: table-cell;
}
<div class="note">
    <div class="spell"> <span class="spelliconwithtitle">text</span>

    </div>
    <hr style="margin: 0; padding: 0;">
    <div style="overflow: auto;width: 100%; min-height: 41px; max-height: 100%; position: relative; display: table; ">
        <p style="padding: 0px 5px 0px 5px;width: 100%;margin: 0 1% 0 1%;display: table-cell; ">test</p>
        <div class="change_icon BUFF">text</div>
    </div>
    <hr style="margin: 0; padding: 0;">
    <div style="overflow: auto;width: 100%; min-height: 41px; max-height: 100%; position: relative; display: table; ">
        <p style="padding: 0px 5px 0px 5px;width: 100%;margin: 0 1% 0 1%;display: table-cell; ">test</p>
        <div class="change_icon NERF">nerf</div>
    </div>
</div>

min-height 不适用于表格。

您必须将其替换为 height

.spell span {
    position: relative;
    top: 25%;
}
.note {
    clear: both;
}
.spell {
    text-align: center;
    max-width: 100%;
    height: 35px;
    background-color: #E7E7E7;
}
.BUFF {
    background-color: #80DE57;
}
.NERF {
    background-color: #DE5B54;
}
.CHANGE {
    background-color: #D2A557;
}
.NEW {
    background-color: #50B9EB;
}
.BUGFIX {
    background-color: rgb(141, 141, 141);
}
.change_icon {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
    color: white;
    vertical-align: middle;
    text-align: center;
    min-width: 70px;
    height: 100%;
    display: table-cell;
}
<div class="note">
    <div class="spell"> <span class="spelliconwithtitle">text</span>

    </div>
    <hr style="margin: 0; padding: 0;">
    <div style="overflow: auto;width: 100%; height: 41px; max-height: 100%; position: relative; display: table; ">
        <p style="padding: 0px 5px 0px 5px;width: 100%;margin: 0 1% 0 1%;display: table-cell;height: 41px; ">test</p>
        <div class="change_icon BUFF">text</div>
    </div>
    <hr style="margin: 0; padding: 0;">
    <div style="overflow: auto;width: 100%; height: 41px; max-height: 100%; position: relative; display: table; ">
        <p style="padding: 0px 5px 0px 5px;width: 100%;margin: 0 1% 0 1%;display: table-cell; height: 41px;">test</p>
        <div class="change_icon NERF">nerf</div>
    </div>
</div>

多样性:

您可以在元素上使用 line-height 而不是 height

.spell span {
    position: relative;
    top: 25%;
}
.note {
    clear: both;
}
.spell {
    text-align: center;
    max-width: 100%;
    height: 35px;
    background-color: #E7E7E7;
}
.BUFF {
    background-color: #80DE57;
}
.NERF {
    background-color: #DE5B54;
}
.CHANGE {
    background-color: #D2A557;
}
.NEW {
    background-color: #50B9EB;
}
.BUGFIX {
    background-color: rgb(141, 141, 141);
}
.change_icon {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
    color: white;
    vertical-align: middle;
    text-align: center;
    min-width: 70px;
    height: 100%;
    display: table-cell;
}
<div class="note">
    <div class="spell"> <span class="spelliconwithtitle">text</span>

    </div>
    <hr style="margin: 0; padding: 0;">
    <div style="overflow: auto;width: 100%; min-height: 41px; max-height: 100%; position: relative; display: table; ">
        <p style="padding: 0px 5px 0px 5px;width: 100%;margin: 0 1% 0 1%;display: table-cell; line-height: 41px; ">test</p>
        <div class="change_icon BUFF">text</div>
    </div>
    <hr style="margin: 0; padding: 0;">
    <div style="overflow: auto;width: 100%; min-height: 41px; max-height: 100%; position: relative; display: table; ">
        <p style="padding: 0px 5px 0px 5px;width: 100%;margin: 0 1% 0 1%;display: table-cell; line-height: 41px; ">test</p>
        <div class="change_icon NERF">nerf</div>
    </div>
</div>