html - 如何在所有浏览器中支持相同的边距

标签 html css cross-browser

我有一张图片潜水。我在 div 类 full_logo_login 中给出 margin 。它适用于 firefox,但不适用于 chrome;我的 CSS 如下:

.full_logo_login{
    height: 345px;
     margin: 7% 0 7% 23%;
 }
.full_logo_login > img {
 height: 345px;
 width: 345px;
 }

margin: 7% 0 7% 23%; 在 firefox 中完美运行,但在 chrome 中,它不工作。 chrome 需要 margin: 2% 0 7% 23%; 才能完美运行。所以我写了这个 CSS:

.full_logo_login{
    height: 345px;
     -webkit-margin:2% 0 7% 23% !important;
     margin: 7% 0 7% 23%;
 }
.full_logo_login > img {
 height: 345px;
 width: 345px;
 }

但现在我的 chrome 浏览器仍然无法正常工作,chrome 仍然接受 margin: 7% 0 7% 23%; 我的完整代码是:

<style type="text/css">
.full_login_box {
  background: #202144 none repeat scroll 0 0 !important;
  display: inline-flex;
  height: 400px;
  margin: 7% auto;
  width: 100% !important;
}
.full_logo_login{
    height: 345px;
     -webkit-margin:2% 0 7% 23% !important;
     margin: 7% 0 7% 23%;
 }
.full_logo_login > img {
 height: 345px;
 width: 345px;
 }
</style>

html:


<div class="full_login_box">
    <div class="full_logo_login">
        <img src="img/loginlogo.png">
    </div>
 </div>

最佳答案

我得到了答案 需要使用这个css -webkit-margin-before:2%

关于html - 如何在所有浏览器中支持相同的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33517995/

相关文章:

html - 浏览器中不一致的文本区域处理

html - 居中 div 中的元素

javascript - 页面加载后立即以编程方式触发 jquery 下拉更改事件

html - 使用 CSS 在 ASP.NET 单选按钮中动态更改颜色

html - @font-face 不适用于 www - firefox

javascript - 检测 WebGL 支持的正确方法?

css - 为什么浏览器供应商要制作自己的 css 属性?

html - css: text-align: center 只适用于多行文本,而不是单行?

html - 将 CSS 样式属性应用于 @Html.TextBox

javascript - 在 Html 元素名称中获取双引号