0

ユーザーが要素の上にマウスを置いたときに、いくつかの要素をわずかに動かそうとしています(それらはナビゲーションバーにボタンを形成します)。しかし、私のコードは機能していないようです。ボックス内のテキストもクリック可能である必要がありますが、それも機能していないようです。コードは次のとおりです。

#navbar {
position: relative;
width: max-width;
height: auto;
margin-left: 2%;
}

.nav_tab{
background-image: url('dark_exa.png');
border: 2px dashed grey;

/* rounded borders of 5px in firefox */
-moz-border-radius:10px;  

/* rounded borders of 5px in chrome and other browsers */
-webkit-border-radius:10px;  

/* rounded borders of 5px in browsers that support css3 */
border-radius:10px;

/* shadows for different browsers */
-moz-box-shadow: 0 0 0 3px black, 2px 1px 4px 4px rgba(10,10,0,.5);
-webkit-box-shadow: 0 0 0 3px black 2px 1px 4px 4px rgba(10,10,0,.5);
box-shadow: 0 0 0 3px black, 2px 1px 6px 4px rgba(10,10,0,.5);
position: relative;
height: auto;
width:20%;
z-index: -1;
margin-left: 2%;
margin-right: 2%;
top: -30px;
display: inline-block;
}

.nav_tab:hover{
position: relative;
top: +5px;
}

h1 {
font-size:40px;
text-align: center;
color: white;
font-family: "Gabriela";
margin: 20px;
margin-top: 130px;
}
h2 {
font-size:30px;
text-align: center;
color: white;
font-family: "Gabriela";
margin: 10px;
margin-top: 40px;
}

そしてHTML:

<div id="navbar">
<div class="nav_tab"><h2><a href="http://www.stackoverflow.com">Zues</a></h2></div>
<div class="nav_tab"><h2>Jack</h2></div>
<div class="nav_tab"><h2>Denise</h2></div>
<div class="nav_tab"><h2>Joel</h2></div></div>

ここで何が起こっているのか完全にはわかりませんが、それはある種の親子の問題だと思います。

ありがとう。

4

2 に答える 2

0

.nav_tabクラスに負の値を指定したため、値を調整するだけでリンクをクリックできませんz-index=> 0で機能します。

于 2013-03-09T14:30:25.947 に答える
0

それz-index: -1;.nav_tabあなたの問題です.CSSのそれはページの背後にあるコンテナを作成するので、マウスイベント(ホバー、ポインタなど)は動作しません.

http://jsfiddle.net/QmVFR/64/

于 2013-03-09T14:33:16.820 に答える