为什么在Safari和Firefox中我的桌子上的最小高度不起作用?

时间:2015-09-14 15:14:22

标签: html css firefox safari

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

这是一个有效的JSFiddle

这是一张显示顶级 - Safari和底部 - Chrome之间比较的图片。它看起来像是最底层的。 http://imgur.com/7fmjEG5

.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>

2 个答案:

答案 0 :(得分:2)

min-height doesn't work on tables.

You will have to replace it with 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>

答案 1 :(得分:0)

For diversity:

Instead of height you can use line-height on the elements.

.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>