CSS3學習筆記——偽類hover作用於子項目

來源:互聯網
上載者:User

標籤:

最近看到一篇文章:“Transition、Transform和Animation使用簡介及應用展示”     ,想看看裡面 “不同緩動類效果demo” 例子的效果,發現了一個問題如下:

.Trans_Box :hover (冒號前空格)這個偽類只能作用於 .trans_box中的子項目,滑鼠移到自身時只能激發其子項目的樣式發生改變。

<!--Html部分代碼-->
<div id="hhh" class="Trans_Box"> <div class="box linear">linear</div> <div class="box ease">ease</div> <div class="box easein">ease-in</div> <div class="box easeout">ease-out</div> <div class="box easeinout">ease-in-out</div></div>
/*CSS代碼*/
.Trans_Box
{ background:#CCC;}.box { background:#09C; border:black 1px solid; font-size:150%; width:100px; height:100px; margin:10px 0; text-align:center;}.linear { transition: all 4s linear; -webkit-transition: all 4s linear; -moz-transition: all 4s linear;}.ease { transition:all 4s ease; -webkit-transition:all 4s ease;}.easein { transition:all 4s ease-in; -webkit-transition:all 4s ease-in;}.easeout { transition:all 4s ease-out; -webkit-transition:all 4s ease-out;}.easeinout { transition:all 4s ease-in-out; -webkit-transition:all 4s ease-in-out;}.Trans_Box :hover { margin-left:89%; background-color:#0CF; border-radius:25px; transform:rotate(360deg); -webkit-transform:rotate(360deg); -moz-transform:rotate(360deg);} .yyy :hover{ //在Trans_Box外層再加一個div,才能捕捉到它的hover操縱 -webkit-transform:rotate(180deg);}

剛剛學習CSS3,以上是調試所得心得,如有錯誤,歡迎大家批評指正。

CSS3學習筆記——偽類hover作用於子項目

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.