【发布时间】:2013-11-25 23:00:54
【问题描述】:
我正在使用线性渐变来创建等高的列。在 Safari 中,一切都排成一列,从桌面到移动都流畅。
我的设置是 2 行,每行包含 2 列,每列下面有一个图像和一个描述框。图像具有响应性,因此尺寸会缩小,但在 Safari 中,这不是问题,一切都会继续排列,即渐变列的边缘(两种颜色相遇的线)在每个断点处与图像一致。
但是,在 Chrome 中,当您缩小时,没有任何内容。它在桌面上很好,但是一旦您查看较小的屏幕尺寸,图像和分隔两列的线就会全部关闭。 我一直在无休止地寻找解决这个问题的方法,但似乎找不到任何东西。
如果有人有任何建议,将不胜感激。
HTML
<article class="rowContainer">
<div class="rowOne">
<section class="floatLeft textLightGreyArea">
<img src="..." />
<p>Description goes here</p>
</section>
<section class="floatLeft textDarkGreyArea">
<p>Description goes here</p>
<img src="..." />
</section>
</div>
</article>
<article class="rowContainer">
<div class="rowTwo">
<section class="floatLeft textLightGreyArea">
<img src="..." />
<p>Description goes here</p>
</section>
<section class="floatLeft textDarkGreyArea">
<img src="..." />
<p>Description goes here</p>
</section>
</div>
</article>
CSS
.rowContainer:after {
visibility: hidden;
display: block;
content: "";
clear: both;
height: 0;
font-size: 0;
}
.rowContainer {
display: inline-block;
}
.rowOne {
overflow: hidden;
background: #c9c9c9;
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #c9c9c9),
color-stop(49.99%, #c9c9c9), color-stop(49.99%, #e0e0e0), color-stop(100%, #e0e0e0));
background-image: -webkit-linear-gradient(left, #c9c9c9, #c9c9c9 49.99%, #e0e0e0
49.99%,
#e0e0e0 100%);
background-image: -moz-linear-gradient(left, #c9c9c9, #c9c9c9 49.99%, #e0e0e0 49.99%,
#e0e0e0 100%);
}
.rowTwo {
overflow: hidden;
background: #e0e0e0;
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #e0e0e0),
color-stop(49.99%, #e0e0e0), color-stop(49.99%, #c9c9c9), color-stop(100%, #c9c9c9));
background-image: -webkit-linear-gradient(left, #e0e0e0, #e0e0e0 49.99%, #c9c9c9
49.99%,
#c9c9c9 100%);
background-image: -moz-linear-gradient(left, #e0e0e0, #e0e0e0 49.99%, #c9c9c9 49.99%,
#c9c9c9 100%);
}
.floatLeft {
width: 49.99%;
float: left;
}
【问题讨论】:
-
提供链接码
-
我刚刚更新了代码 - 我想上传一张图片,但我认为我不能
-
你能设置一个jsfiddle 吗?
-
好的,我一会儿试试
-
这里是设置 - 虽然我注意到右图底部有一个间隙jsfiddle.net/Ht25w/1 - 你能在 chrome 中看到这是一个微小的间隙而不是齐平吗,在我的网站上因为它的规模更大,所以它非常明显和丑陋。
标签: css height gradient equals