我想在鼠標懸停在speechbubble(已創建)上時更改文本,並在鼠標返回時設置文本。我有一個「歡迎!」在speechbubble上設置的文本,我希望它更改爲「向下滾動」。另一個問題是,我已經設置在speechbubble一個css轉型+歡迎,這樣就更難..更改懸停,CSS和html上的文本
這裏是我的代碼:
#welcome{
position:absolute;
top:50%;
left:50%;
width:auto;
height:auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
#speechbubble {
margin-left:110px;
width: 230px;
height: 80px;
line-height:80px;
text-align:center;
font-size:15px;
letter-spacing:2px;
-moz-box-shadow: 5px 5px 5px #888;
-webkit-box-shadow: 5px 5px 5px #888;
box-shadow: 5px 5px 5px #888;
font-family:{select:Title Font};
background: {color:Welcome background};
color:{color:Welcome text};
position: relative;
font-weight:bold;
}
#speechbubble:before {
content:"";
position: absolute;
right: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {color:Welcome background};
border-bottom: 13px solid transparent;
}
#welcome:hover #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
margin-left:120px;
}
#welcome #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
<div id="welcome">
<div id="speechbubble">Welcome!</div>
我已經嘗試了一些技巧就像爲第二個文本添加一個div並設置一個css懸停,但它沒有工作..任何人都可以幫助我?謝謝
謝謝,這是最簡單的,如果不是正確的做法! –
隨時歡迎您:) –