css實現滑鼠移入移出動態效果

來源:互聯網
上載者:User
這篇文章主要介紹了關於css實現滑鼠移入移出動態效果,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下

知識點:transform-origin

相容性:IE10以上

<!DOCTYPE html><html><head><meta charset="utf-8" /><title></title><style>p {    position: absolute;    width: 200px;    height: 60px;    text-align: center;    margin: 10px auto;}p::before {    content: "";    position: absolute;    left: 0;    bottom: 0;    width: 200px;    height: 2px;    background: deeppink;    transition: transform .5s;    transform: scaleX(0);    transform-origin: 100% 0;//以(100%,0)座標為基本點移動即縮小到0倍---->scaleX(0)}p:hover::before {    transform: scaleX(1);    transform-origin: 0 0;//以(0,0)座標為基本點移動即放大到1倍---->scaleX(1)}</style></head><body><p>Hover Me</p></body></html>
相關文章

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.