- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 IE7 中遇到一个奇怪的错误,其中边距似乎添加了两次。一次位于 thing
元素下方的正常位置,另一个位于按钮和容器底部之间。 请注意,按钮本身有 margin-bottom
,但我说的是在其下方添加的额外边距。
您可以在下面的 gif 中看到,当我在 thing
元素上切换 margin-bottom
时,它会切换 thing
之间的空间> 元素和按钮(正常),但也在按钮和容器末端之间(错误)。
我有一种感觉,这是 zoom: 1;
hasLayout clearfix 在 .block
上使用的一部分。如果我添加一个明确的 clear: both;
div,它也有这个额外的空间,但是可以通过将 height: 0;
放在 clear div 上来减轻这一点。
这个额外的空间只出现在 float: right;
按钮上
我使用的是 HTML5 文档类型,但也尝试过严格的文档类型,它在真正的 IE7 或模拟版本中没有效果。
如何在保持自清的同时去除底部多余的空间micro-clearfix dom结构?
下面的 gif 来自具有 IE7 仿真/兼容性的 Windows 8.1 IE。这是 same bug in true IE7 on Windows XP .
.block
{
background: #888888;
/* Clearfix */
zoom: 1;
}
.thing-with-margin
{
margin-bottom: 10px;
background: #88dd88;
}
.button
{
float: right;
/* Make the input/button shrink to the correct size in ie7 */
overflow: visible;
margin-bottom: 10px;
padding: 0 8px;
background: #6666cc;
border: 0;
}
.heading
{
background: #aaaaaa;
border-bottom: 1px solid #000000;
}
This is IE7 only code at the moment stripped down to show off this problem. View it in IE7 mode.
<br />
<div class="block">
<div class="heading">Aenean vulputate</div>
Lorem ipsum dolor sit amet
<div class="thing-with-margin">
Ipsum dolor amet Lorem.
</div>
<input type="submit" class="button" value="Sign Up">
</div>
最佳答案
我没有找到解释或其他人遇到同样的问题。
但我找到了一个非常有效的解决方案,不幸的是它有点老套。
将此缩放声明并排添加到 .block
父元素的 zoom: 1;
中。 expression
(动态属性)值适用于 IE7- 并允许基本的 JavaScript。
缩放:表达式(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif");
来源: NBFC Overflow hack in Better float containment in IE using CSS expressions
我建议您使用条件样式表而不是 CSS 属性 hacks(*
),但我已将它们保留在其中,这样它很好并且可以复制粘贴。
.clearfix
{
/* Clearfix: http://nicolasgallagher.com/better-float-containment-in-ie/ */
/* for IE 6/7 */
*zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif");
/* non-JS fallback */
*zoom: 1;
}
.clearfix:before,
.clearfix:after
{
content: ' ';
display: table;
}
.clearfix:after
{
clear: both;
}
.block
{
background: #888888;
/* Clearfix: http://nicolasgallagher.com/better-float-containment-in-ie/ */
/* for IE 6/7 */
*zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif");
/* non-JS fallback */
*zoom: 1;
}
.block:before,
.block:after
{
content: ' ';
display: table;
}
.block:after
{
clear: both;
}
.thing-with-margin
{
margin-bottom: 10px;
background: #88dd88;
}
.button
{
float: right;
/* Make the input/button shrink to the correct size in ie7 */
overflow: visible;
margin-bottom: 10px;
padding: 0 8px;
background: #6666cc;
border: 0;
}
.heading
{
background: #aaaaaa;
border-bottom: 1px solid #000000;
}
<div class="block">
<div class="heading">Aenean vulputate</div>
<div>
Lorem ipsum dolor sit amet
</div>
<div class="thing-with-margin">
Ipsum dolor amet Lorem.
</div>
<input type="submit" class="button" value="Sign Up">
</div>
关于css - IE7 : Extra space caused by Clearfix container with element `float: right;` and margin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27758068/
我正在尝试使用一个使用 JNI 的库。 我已经尝试了开发人员提供的示例应用程序,它可以工作。所以我知道这不是库中的错误。 我认为我在导入库的过程中做错了什么: 将 .so 文件复制到我的 libs 文
使用Websphere 应用程序服务器 + Wicket 1.6我的挂载 URL 遇到一些问题。 当我调用类似于以下内容的网址时:localhost:9080/danesCooking/pies/me
我有一个应用程序在 Win2k3 VM 上的 Apache Tomcat 5.5 上运行。该应用程序提供 XML,供某些电话设备使用,作为我们 IVR 基础设施的一部分。反过来,应用程序从一些 SOA
升级到雅加达给我带来了一些问题。。我正在使用以下maven插件:。并且我使用episodal编译(有库)。突然间,我面临着以下问题:。更仔细的检查发现,XJC突然生成了以下字段:。这是它以前没有产生的
Jenkins 有一个可用于自由式构建作业的 $CAUSE 变量。 如何在工作流程中访问此内容或类似内容? 我的团队在现有临时构建的电子邮件输出中使用它。我们希望在新的基于工作流的工作中继续这样做。
错误:无法完成 Gradle 执行。 原因: Could not create parent directory for lock file C:\Program Files\Android\Andr
如何确定多个浏览器 UI 事件是否由相同的基本 UI 交互引起? 例如,用户单击和事件监听器会触发“blur”和“mousedown”事件。有没有办法确定这两个事件都是由一次用户点击引起的? 最佳答案
它可以编译,但不会从 .o 文件链接到可执行文件。我已经删除了从现在到运行良好时所做的所有更改(基本上,str_to_int 中的所有内容)。 我的代码: #include #include in
关于 Java 的 InterruptedException 有一些有趣的问题和答案。 ,例如 The Cause of InterruptedException和 Handling Interrup
我使用 android 工具 “内存监视器” 来修复内存泄漏。这很有帮助。 但是,我需要澄清一下。 有时在运行该应用程序后,分配的内存为“47MB”。当与应用交互时,它会上下移动。 然后当我点击“ca
我正在调查由于堆损坏而导致的崩溃。由于这个问题很重要并且涉及分析堆栈和转储结果,因此我决定对与崩溃相关的文件进行代码审查。 坦率地说,我对堆何时可能损坏没有深入的了解。 如果您能提出可能导致堆损坏的方
假设我们有一个名为 feature-branch 的功能分支。该分支的开发人员分支获取他们的票,然后打开一个 PR 到 feature-brach。 如果发生以下情况: 开发人员A从feature-b
两个线程同时访问fileName。 Set If 0 使死锁。但如果 1 一切顺利。 那么是什么导致了这种情况? 最佳答案 确保您没有在主线程上同步调用 +[PHAssetResource asset
不幸的是,我还不是正则表达式专家,因此遇到了以下问题:假设我有一个包含多个链式异常的 Java 堆栈跟踪,我想要达到的是提取以“Caused by”开头的最后一行。 javax.servlet.Ser
我确信这是我所缺少的非常简单的东西。我使用 makeKeyAndOrderFront: 打开一个窗口,它第一次工作。当我关闭窗口并尝试再次打开它时,它退出并给出错误EXC_BAD_ACCESS。我的代
我刚刚探索了 Rank2Types 和 RankNTypes,试图熟悉它们。但我不明白为什么以下不起作用。 g :: (forall a. forall b. a -> b) -> x -> y ->
我想验证输入是否严格是由 10-16 个字符长组成的数字。根据用户输入值,我将在输入字段下方显示一条消息。问题是,当我去使用时为了帮助完成此任务,它会导致应用程序抛出异常。 我是 JSF 新手,我很难
许多内置的 Java 异常无法接受“原因”。有什么方法可以为这些异常指定原因吗? 我希望能够链接异常,就像这个 InterruptedException 示例一样: try{ //thread
我创建了一个 JSP Mysql 和 Bootstrap Crud 应用程序。当我单击“更新”按钮时,将调用函数 validation() 来更新所有字段,在成功更新后,它将重定向到另一个 JSP 页
我看到了奇怪的情况:在我的 Android 应用程序代码中使用类似这样的东西时我没有收到任何错误: @Override public void onBackPressed() { if
我是一名优秀的程序员,十分优秀!