奇怪的 CSS 行为
我正在为一个网站做 HTML 和 CSS,我遇到了一个非常奇怪的错误/行为,我无法确定。
看看http://www.atelierhsl.nl/antwerp/。顶部的徽标有一条白线穿过。如果我在页面底部显示:无导航,它就会消失。但是当我增加文本列(.entry-content)的底部填充时,它会再次出现。这种情况发生在 Webkit、Mozilla 和 IE 中,所以我知道我一定做错了什么。我就是不明白是什么。有人吗?
I'm doing HTML and CSS for a site, and I've come across a very weird bug / behaviour that I can't pin down.
Take a look at http://www.atelierhsl.nl/antwerp/. There's a white line through the logo at the top. If I display:none the navigation at the bottom of the page, it disappears. But when I increase the bottom padding of the text column (.entry-content) it reappears again. This happens in Webkit, Mozilla and IE, so I know I must be doing something wrong. I just can't figure out what. Anybody?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是由身体背景图像顶部的抗锯齿线(仅 1 个浅灰色像素)引起的。简单的答案是使用图像编辑器裁剪它。
您可能希望将图像与顶部对齐:
主要问题是背景图像没有它应覆盖的区域那么大。
This is caused by an anti-aliased line on the top your body's background images (just 1 pixel of light gray). The simple answer is to crop it using an image editor.
You may want to align the image to the top:
The main problem is that the background image isn't as big as the the area it should cover.
Kobi 的答案是正确的,但如果您不介意设计建议:不要将黑色背景图像放在正文的不重复顶部,而是将正文内容分离到容器和页脚中。对于内容背景,使用较小的背景图像并将其平铺,或将背景颜色设置为黑色,因为看起来没有渐变。然后,页脚 div 可以具有白色背景(从正文继承,或直接分配)。
您的页面在逻辑上分为主要内容和页脚,因此 HTML 应该表达这一点。
Kobi's answer is correct, but if you don't mind a design suggestion: Rather than putting a black background image at no-repeat top for the body, separate body content into a container and a footer. For the content background use a smaller background image and tile it, or set the background color to black, since it appears you have no gradient. The footer div can then have a white background (inherited from the body, or just assigned directly).
You page is logically divided into main content and a footer, so the HTML should express that.
有两种解决方案:
There is two solutions:
我认为,你应该从背景中剪下一条 1px 的线并重复它。不会有任何错误,并且您将减少图像权重。
I think, you should cut a 1px line from your background and to repeat-y it. There will be no bug, and you will decrease the image weight.