2011-01-31 28 views
0

ナビゲーションバーのホバー状態にミニ三角形を追加しようとしています。CSS - ホバー効果のために複数のクラスを使用する

HTML:

 <div id="menu_bars"> 
      <div id="main_bar"> 
       <ul> 
        <li class="maintabs maintabs_tri"><a href="#">Over</a></li> 
<li class="maintabs maintabs_tri"><a href="#">Collar</a></li> 
<li class="maintabs maintabs_tri"><a href="#">Bod</a></li> 
       </ul>   
      </div> 

      <div id="css_arrow" class="maintabs_tri"><a href="#"></a> 
      </div> 
     </div> 

'main_bar' divが水平ナビゲーション・メニューを作成します。 div id 'css_arrow'は、ホバー状態で表示される矢印を作成するために使用されています。 私はゲームのすべてのクラスを 'maintabs_tri'という三角形と 'main_tab'ナビゲーションメニューが含まれているので、ホバー状態がアクティブになると三角形がナビゲーションバーに表示されます。

CSS:これが機能しない理由

/* START OF MAIN BAR */ 
#main_bar ul { 
    float: left; 
    width: 630px; 
    height: 48px; 
} 

.maintabs { 
    display: inline-block; 
    width: 25%; 
    list-style-type: none; 
    background: rgba(237,237,237,1); 
    background: -moz-linear-gradient(top, rgba(255,255,255,1), rgba(237,237,237,1)); 
    background: -webkit-gradient(linear, top, bottom, from(rgba(255,255,255,1)), to(rgba(237,237,237,1))); 
    -moz-box-shadow: 1px 2px 2px rgba(0,0,0,0.2); 
    -webkit-box-shadow: 1px 2px 2px rgba(0,0,0,0.2); 
    box-shadow: 1px 2px 2px rgba(0,0,0,0.2); 
    -webkit-transition-property: 
} 

.maintabs:first-child { 
    -webkit-border-top-left-radius: 6px; 
    -webkit-border-bottom-left-radius: 6px; 
    -moz-border-radius-topleft: 6px; 
    -moz-border-radius-bottomleft: 6px; 
    border-top-left-radius: 6px; 
    border-bottom-left-radius: 6px; 
} 

.maintabs:last-child { 
    -webkit-border-top-right-radius: 6px; 
    -webkit-border-bottom-right-radius: 6px; 
    -moz-border-radius-topright: 6px; 
    -moz-border-radius-bottomright: 6px; 
    border-top-right-radius: 6px; 
    border-bottom-right-radius: 6px;   
} 

.maintabs a { 
    display: block; 
    text-decoration: none; 
    text-align: center; 
    vertical-align: middle; 
    line-height: 14px; 
    text-shadow: 0px 1px 2px rgba(0,0,0,0.3); 
    padding: 18px 0px; 
} 

.maintabs ul { 
    display: none; 
    list-style-type: none; 
} 

.maintabs ul li a { 
    text-decoration: none; 
} 
/* END OF MAIN BAR */ 



/* TRIANGLE ------ for testing, to be used with hover later */ 
#css_arrow { 
    border-color: transparent transparent rgba(111,46,11,0.0) transparent; 
    border-style: solid; 
    border-width: 8px; 
    height: 0; 
    width: 0; 
    position: absolute; 
    top: 34px; 
    left: 78px; 
} 

.maintabs_tri a:hover { 
    border-color: transparent transparent rgba(111,46,11,1) transparent; 
} 

誰かが共有してもらえますか?私は私の人生を理解することができません...

答えて

1

.maintabs_tri a:hoverに追加すると、border-bottom: 3px solid #000はChromeで修正されます。

border-widthまたはborder-styleが定義されていないという問題がありました。

+0

@Kayote:私の答えはあなたのために働いたのですか? – thirtydot

+0

Thirtydot、それはありませんでした。問題は、ホバー効果がメニューバーを完全に分割することです。私はより良い言葉でこの質問を再投稿し、あなたにリンクを送るでしょう。このためにタイムアウトを取ってくれてありがとう。最高、 – Kayote

+0

thirtydot、ここに新しい投稿へのリンクがあります: http://stackoverflow.com/questions/4870912/css-adding-another-elements-on-hover-state – Kayote

関連する問題