Z-index 不起作用
Possible Duplicate:
Css z-index problem
I have an issue where one image is infront of another and z-index doesnt seem to change it.
I am trying to make it so the logo is on top of the gray bars image.
Can anyone explain to me why this is not working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
z-index
仅适用于position:relative/absolute/fixed
,因此请为您的徽标提供position:relative
。http://jsfiddle.net/vzPUw/1/
已更新
< a href="http://jsfiddle.net/vzPUw/3/" rel="nofollow noreferrer">http://jsfiddle.net/vzPUw/3/
在此,我更改了标记因为我们从来没有将
block
元素放在inline
元素中。是一个
inline
元素 &h1
是一个block
元素。z-index
only works withposition : relative/absolute/fixed
so giveposition:relative
to your logo.http://jsfiddle.net/vzPUw/1/
Updated
http://jsfiddle.net/vzPUw/3/
In this, I changed in the markup because we never put
block
element inside aninline
element.<a>
is aninline
element &h1
is ablock
element.z-index:0;
不是一个好的使用值。您应该至少使用 1。 1是窗座。从技术上讲,0 位于窗口下方。您只需调用正确的元素(锚点而不是其中的图像),因为锚点是容器。然后是边距和放置位置的问题。
这里是 jsFiddle
z-index:0;
isn't a good value to use. You should use 1 as a minimum. 1 is the window base. 0 is technically below the window.You simply need to call the right element (the anchor not the image within it) since the anchor is the container. Then it's a matter of margins and position for placement.
jsFiddle Here
看到这里我这里有变化......
-删除条形图像的 img 标签并放置标题标签的背景..:)
-这里我认为你不需要位置属性和 z-index..:)
see here i have change here...
-remove img tag for bar image and put background of header tag.. :)
-here i think you no need for position property and z-index.. :)