html - Firefox 和 chrome 的 css 差异 : element height is different

标签 html css google-chrome firefox

我在设计新网站时遇到了问题。我的元素的高度在 Chrome 和 Firefox 之间不同。

这就是区别

Difference hight between Firefox and Chrome

这是html代码

<div class="bottombar">
    <ul>
        <li><button><span class="glyphicon glyphicon-thumbs-up"></span> Like</button></li>
        <li><button class="comment"><span class="glyphicon glyphicon-comment"></span> Comment</button></li>
        <li><button><span class="glyphicon glyphicon-thumbs-up"></span> 0</button></li>
        <li><button class="showcomments"><span class="glyphicon glyphicon-comment"></span> 0</button></li>
    </ul>
</div>

这是我的css代码

.bottombar {
    background: -webkit-gradient(linear,left top,left bottom,color-stop(0, rgba(255,255,255,1)), color-stop(1, rgba(245,245,245,1)));
    background: -moz-linear-gradient(center top, rgba(255,255,255,1), rgba(245,245,245,1));
    margin: 2px -5px 0px -5px;
    border-top: solid 1px #ccc;
    border-bottom: solid 1px #ccc;
    position: relative;
    height: auto;
    display: block; 
    height: 26px;
}
.bottombar ul {}
.bottombar ul li {
    list-style-type: none;
    float: left;
    border-right: solid 1px #ccc;
}
.bottombar ul li button {
    border: 0px;
    display: block;
    background: rgba(255,255,255,0.0);
    padding: 5px;
    cursor: pointer;
}
.bottombar ul li button:hover {
    background: #fff;
}

当我添加

<div class="clear"></div>
.clear { clear: both;}

我有这个问题

problem

任何帮助:)

最佳答案

如果您使用重置或最好使用规范化 CSS 文件,则可以处理大多数浏览器渲染差异(尤其是高度)。

将此 CSS 文件包含在您的 HTML 中,看看效果如何。

http://necolas.github.io/normalize.css/

关于html - Firefox 和 chrome 的 css 差异 : element height is different,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26082166/

相关文章:

html - 如何继承div中的高度?

css - SASS/SCSS 的@if 用于选择要使用的图像类型?

javascript - 当聚焦位于模式内部的输入时防止页面滚动

html - 在 HTML5/Chrome 中获取 AudioBuffer 的 onended 事件

javascript - 从选项页面更新 chrome 扩展 list 权限

php - 博客容器未显示正确的背景

javascript - 如果我包含标题,CSS/JS 将无法工作

javascript - 使用 AJAX 将表单提交到两个位置

javascript - 响应元素高度应等于宽度

javascript - 浏览器支持 Javascript 中的类语法