2012-12-18 56 views
0

我的客戶想要的是當您將鼠標懸停在淺橙色上時,它會變成深橙色,這很容易,但是當您到達按鈕的中心並將鼠標懸停在深橙色它變成了淺橙色(這是我有一個困難時期的..請指教CSS翻轉1 div和另一個div的變化

enter image description here

<a href="#"><div class="buttonblue"> 
<div class="buttontitle">local businesses</div> 
<div class="buttonaction_blue">NEXT</div> 
<div class="buttonsmallprint">Leverage online</div> 
</div></a> 

CSS

.buttontitle { 
font-family: 'BebasNeueRegular', Arial, sans-serif; 
letter-spacing: 0; 
padding:4px 0px 4px 0px; 
font-size:36px; 
color:#fff; 
text-align:center; 
} 
.buttonaction_blue:hover 
    { 
    background-color:#418dc7 
    } 
    .buttonaction_blue 
{ 
    width:355px; 
    margin:0 auto; 
    background-color:#4795d1; 
    -webkit-border-radius: 2px; 
    -moz-border-radius: 2px; 
    border-radius: 2px; 
    font-family: 'Oxygen', sans-serif; 
    font-size:32px; 
    text-align:center; 
    color:#fff; 
    padding:10px 0px 10px 0px; 
    } 
+1

請發佈您的CSS。 – j08691

+0

顯示你如何完成到現在。現場示例。 – Damonsson

+0

請張貼CSS! –

回答

0

看起來你只是想堆棧:徘徊了div:

http://jsfiddle.net/tSZ2u/1/

.buttonaction_blue:hover { 
    background-color:#5BCAE9 
} 

.buttonblue:hover { 
    background-color: #4795d1; 
} 

如果添加一個懸停到bluebutton和buttonaction_blue既解決了問題,很好。如果沒有,則項目的父級(此時)沒有CSS選擇器。您需要使用.parent()來查看一些jQuery:http://api.jquery.com/parent/

+0

嗯那是精確的什麼我試圖做...但是當我到達中心div有沒有辦法讓持有人切換顏色如此堅實淡藍色? –

+0

不幸的是,你需要使用一些jQuery來做到這一點 - CSS中沒有父選擇器(.buttonblue <.buttonaction_blue或.buttonaction_blue:parent不存在)。你可以編寫一些代碼來在jQuery中使用.parent選擇器。 – MikeTedeschi

0

你說

"What my client wants is when you hover over the light orange it changes to the dark orange" 

如果你想淺橙色(這是你的榜樣,即提供藍色)更改爲黑色和暗橙色沒有變化那麼這個

.buttonaction_blue:hover 
{ 
background-color:#418dc7 
} 

代之以

.buttonblue:hover 
{ 
background-color:#5BCAE9; 
} 

或者如果你想要淺橙色(在你的例子中是藍色的,即提供)變爲深色和深橙色變爲淺橙色,然後只需添加這個

.buttonblue:hover 
{ 
background-color:#418dc7; 
} 

jsfiddle