CSS 背景颜色未按预期表现
我不明白为什么这里没有按预期应用背景颜色。这可能是我对CSS中元素之间的关系缺乏了解?
有问题的页面: http://www.preview.imageworkshop.com/portfolio/
< strong>复制问题
- 首先,在 IE 7 或 IE 8 中打开上述链接
- ,单击“产品”过滤器,然后按“促销和促销”按钮。编辑过滤器
- 白点会出现在一些图像上(这是 IE 中的一个错误,导致一些像素在淡入淡出动画后保持透明。如果您没有看到它们,请多做一些过滤,它们会显示得相当好)
CSS 背景颜色问题
有效方法: 如果我将图库背景的背景颜色设置为红色,则该红色会通过图像上的透明点显示。 (这里的推论是,黑色背景颜色隐藏了“白点”错误)。
#isotopegallery{background:red;}
什么不起作用: 显然,我不想将图库背景颜色设置为白色以外的任何颜色。 我想要做的是设置包含图像的 DIV 的背景颜色,例如:
.photo{background:red;}
但是,当我这样做时,红色背景颜色不会通过透明像素显示出来?
元素结构的简化概述如下
<div id="isotopegallery" class="photos">
<div id="ngg-gallery-18-71">
<div class="photo"> <p><a> <img /> </a></p> </div>
<div class="photo"> <p><a> <img /> </a></p> </div>
<div class="photo"> <p><a> <img /> </a></p> </div>
<div class="photo"> <p><a> <img /> </a></p> </div>
</div>
</div>
帮助!
我不明白为什么这个背景颜色适用于#isotopegallery父DIV,但不适用于.photo DIV?
当我查看 firebug 时,为 .photo div 设置了颜色属性,但没有通过透明像素显示?
这是他在我们网站上发布的最后一期,这让我发疯! 我非常感谢您为我解决此问题提供的任何帮助。
注意:有信息表明,在 Photoshop 中更改图像的黑点可以解决此问题。我们尝试过这个方法,发现行不通。
I don't understand why the background color is not being applied as expected here. This might be a lack of understanding on my part as to the relationships between elements in CSS?
The page in question: http://www.preview.imageworkshop.com/portfolio/
Replicating the issue
- First, open the above link in IE 7 or IE 8
- Click the PRODUCT filter, then press the PROMO & EDITORIAL filter
- White dots will have appeared on some of the images (this is a bug in IE which causes some pixels to be left transparent after a fade animation. if you don't see them, do a little more filtering, they turn up fairly quickly.
CSS BACKGROUND COLOR PROBLEM
What works:
If I set the background color for the gallery background to be red, then this red color shows throught the transparent spots on the images. (The inference here, is that a background color of black hides the 'white spots' bug).
#isotopegallery{background:red;}
What doesn't work:
Obviously, I don't want to set the gallery background color to be anything but white.
What I want to do is set the background color of the DIV that contains the images, for example:
.photo{background:red;}
however, when i do this, the red background color does not show up through the transparent pixels??
The simplified overview of the structure of the elements is as follows
<div id="isotopegallery" class="photos">
<div id="ngg-gallery-18-71">
<div class="photo"> <p><a> <img /> </a></p> </div>
<div class="photo"> <p><a> <img /> </a></p> </div>
<div class="photo"> <p><a> <img /> </a></p> </div>
<div class="photo"> <p><a> <img /> </a></p> </div>
</div>
</div>
HELP!
I can't figure out why this background color works for the #isotopegallery parent DIV, but not for the .photo DIV?
When i look in firebug, the color property is set for the .photo div, but does not show through the transparent pixels?
This is the last issue that his holding up go live for our website, and it is driving me nuts!
I would really appreciate any help that you can provide to help me resolve this issue.
NOTE: there is info around that suggests that changing the blackpoint of the images in photoshop will fix this problem. We have tried this method, and have found it does not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否浮动
.photo
的内部元素而不清除它们?这将防止背景颜色覆盖相关元素的高度。如果是这种情况,请附加类似
到.photo
div 应该可以解决问题。同样,您始终可以尝试将背景颜色应用于
img
元素本身:.photo img { background-color: red;}
Are you floating the interior elements of
.photo
without clearing them? That would prevent the background color from covering the height of the element in question.If that's the case, appending something like
<br style='clear: both;' />
to the.photo
div should do the trick.Likewise, you could always try applying the background color to the
img
elements themselves:.photo img { background-color: red;}
isotope的创建者一直在帮我研究这个问题,并添加了以下评论:
不知道从这里到哪里去。我们尝试过移动黑点(因为这应该是由真正的黑色像素引起的),但发现这是一个不成功的方法。
The creator of isotope has been helping me look at this issue, and has added the following comment:
Not sure where to go from here. We have tried moving the black point (as this is supposed to be caused by true black pixels), but have found this to be an unsucessful method.
我找到了这个问题的解决方案。我已经发布了针对此主题的完整详细信息(下面的链接),其中更详细地描述了该问题。
IE 淡入淡出导致图像上出现白点
I found a solution to this issue. I have posted full details against this thread (link below), which describes the issue in more detail.
IE fade causing white spots on images