- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我尝试在 div 上应用背景色,div 完全填充背景。
我在 Chrome 上成功实现了它,但在 Firefox 上遇到了一些问题。
这是我的.html
:
<div class="col-sm-3 text-center">
<div class="to_be_filled" id="status-sessions">
<div class="background-icon">
</div>
<div class="row">
<div class="col-xs-6 text-right">
</div>
</div>
</div>
</div>
还有我的.css
.to_be_filled {
background: #fff;
background-size: contain;
-webkit-border-radius: .25em;
-moz-border-radius: .25em;
border-radius: .25em;
margin: 0 1em;
padding: 2em;
position: relative;
color: #929292;
}
在 Chrome 上,整个 div 被白色背景填充。
在 Firefox 中,白色背景填满了 div 的整个高度,而不是整个宽度。
如何使 Firefox 具有与 Chrome 相同的行为?
最佳答案
如果有背景图像,则使用背景大小。也就是说,background-size 仅适用于背景图像以使其具有该尺寸,但不适用于 background-color。
您的 div 包含边距,因此它向您显示那里的空间。将边距设置为 0。
.to_be_filled {
background-color: #fff;
-webkit-border-radius: .25em;
-moz-border-radius: .25em;
border-radius: .25em;
margin: 0;
padding: 2em 3em;/*1em adjusted for your layout as used in margin*/
position: relative;
color: #929292;
}
我仍然不能告诉你设置 padding: 2em 3em;由于缺少插图,将根据您的布局产生结果,但仍然希望您可以通过自己构建来管理它们。
可能您在 chrome 中看到它作为您的布局,但这实际上不是背景大小效果,而是由于 margin-collapsing问题。如果该问题与 margin-collapse 有关,请参阅 post .
我也回答了 margin-collapse 相关的帖子,这可能对你有帮助。查一下here .
或者,它可能是 float 元素问题。如果问题仍然存在,您需要清除 float 。为了简单地避免这个问题,您可以将 overflow:hidden;
设置为 div 或者您可以在 google 上搜索 clearfix。
关于html - Mozilla Firefox CSS 无法在 <div> 上应用背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38368708/
有没有人能够构建静态链接的 NSS?我实际上只需要构建静态链接的 certutil 和 pk12util。我已经看到 Chromium 正在静态构建 NSS,他们甚至有一个补丁文件,但整个构建过程非常
我正在尝试使用下面的 css 和 html 代码在弹出窗口的底部应用空间,因为我只有 mozilla 浏览器有问题,我在弹出窗口的末尾没有获得空间。下面是我的代码我已经使用过,但我需要减少 chrom
我使用下面的行,这样当我单击“新建”按钮时,它将清空所有字段。使用 onClick="history.go(0)"在 IE 中有效,但在 Mozilla 中失败。 最佳答案 要清空所有字段,请使
我尝试在一个简单的 A-Frame WebVR 应用程序上禁用检查器,但没有成功。 尝试使用 JavaScript 来使用并禁用按键 Ctrl + Alt + I。但是,Inspector 仍在加载。
我正在做一个项目,现在正在测试中。需要使网站与所有现代兼容,并至少使它们与每个主要浏览器的 2 个旧版本兼容。 为此,我在 IE 中使用了 IE F12 工具,以切换到 IE 9、8、7 View 。
我在项目中将gulp与autoprefixer一起使用,并且必须像这样使用背景渐变: background: linear-gradient(#e98a00, #f5aa2f); 但输出是: back
如果我想限制电子邮件地址访问网站,使用 Persona 有哪些优势?我必须以相同的方式管理我服务器上的授权电子邮件地址吗?缺少什么? 最佳答案 在您的网站上使用 Persona 的两个主要优点是: 您
Thunderbird的过滤机制非常适合简单的事情。 但我想做类似的事情 (如果邮件包含xy或发件人为yz)并且状态已读取,请移至回收站 问题是,一个过滤器规则只能匹配任何(= OR)或所有(= AN
有一个奇怪的 webVR Mozilla A-Frame 问题 所以我在 a-curvedimage 标签中加载图像(里面有一些动画内容),如下所示: 我正在检查 chrome 中的网络
我觉得其中缺少了一些东西。这是: 嵌套函数和闭包 您可以在函数中嵌套函数。嵌套(内部)函数对其包含(外部)函数是私有(private)的。它还形成了一个封闭。闭包是一个表达式(通常是一个函数),它可以
JS BIN Attempt 尝试按照示例进行操作,但似乎不起作用。有点困惑,因为它是 Mozilla。 Mozilla 最佳答案 正如 @Xaerxess 提到的,当 DOM 准备好进行操作时,您需
我需要制作一个可以在每个页面和浏览器上运行的按钮,可以从文本区域复制输入。我正在尝试使用以下函数来做到这一点: selectElementContents: function(){ el
我需要一个粘性栏在一定的滚动后可见并固定。我打算使用滚动事件,然后我遇到了 Mozilla 页面,该页面建议使用 window.requestAnimationFrame 如下: var last_k
我希望我的元素具有多种颜色的清晰背景渐变。在 Chrome 上运行良好,但在 Firefox 上过渡时边缘模糊。 这里有一些例子: 火狐: Chrome : 如何让它在 Firefox 上运行? .f
为什么这是Webkit用户代理: Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/534.27+ (KHTML, like Gecko) Version
我正在尝试使用 JavaScript 创建一个游戏,但在此过程中我发现了 Firefox 中的一个错误。游戏很简单。您应该猜测 RGB 十六进制代码中的颜色是什么。有6个框,您应该单击该框,如果错误或
我在 Mozilla 和 Chrome 中都有一个扩展,在我的扩展中我调用了一个远程 JS 文件。 为了避免 Chrome 中的 CSP,我将规则添加到 manifest.json 并且我的文件通过
我找到了一种将我的 Chrome 扩展程序转换为模块的便捷方法(更易于维护等)。我是这样做的https://stackoverflow.com/a/53033388/9182284 (把backgro
我有以下代码来设置选择框的样式,它在 chrome 中完美运行,但在 mozilla fire fox 27.0 中运行不正常 .select-box { line-height: inhe
我没有询问变换原点。我问为什么动画在 mozilla 上不起作用 我一直在 Mozilla 上做一些动画 svg。我在 Chrome 中尝试过的动画效果非常好,但是当我在 mozilla 上测试时效果
我是一名优秀的程序员,十分优秀!