Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
518 views
in Technique[技术] by (71.8m points)

css - Z-index Won't Work

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.

http://jsfiddle.net/vzPUw/

Can anyone explain to me why this is not working?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

z-index only works with position : relative/absolute/fixed so give position: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 an inline element. <a> is an inline element & h1 is a block element.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...