用CSS3實現滑鼠浮動放大圖片

來源:互聯網
上載者:User
這次給大家帶來用CSS3實現滑鼠浮動放大圖片,用CSS3實現滑鼠浮動放大圖片的注意事項有哪些,下面就是實戰案例,一起來看一下。

無需JS和jQuery代碼實現CSS3滑鼠浮動放大圖片

<html><head><title></title><style>.box {    /* 可見視覺地區 */    width: 480px; height: 250px;    position: relative;    overflow: hidden;    cursor: pointer;}.size {    width: 1000px; height: 1000px;    position: absolute; left: 50%; top: 50%;    margin: -500px 0 0 -500px;    /* 水平置中 */    text-align: center;}.zoom {    /* 縮放的元素 */    width: 480px; height: 250px;    vertical-align: middle;        -webkit-transition: -webkit-transform .2s;    transition: transform .2s;}.box:hover .zoom {    /* hover放大 */    -webkit-transform: scale(1.05);    -ms-transform: scale(1.05);    transform: scale(1.05);    zoom: 1.05;}:root .box:hover .zoom {    zoom: 1;}.middle {    /* 垂直置中 */    display: inline-block;    width: 0; height: 100%;    vertical-align: middle;}</style></head><body><h4>左上方定位</h4><p class="box"><img src="dafu.jpg" class="zoom"></p><h4>置中定位</h4><p class="box">    <p class="size">        <img src="dafu.jpg" class="zoom"><i class="middle"></i>    </p></p></body>

相信看了本文案例你已經掌握了方法,更多精彩請關注php中文網其它相關文章!

推薦閱讀:

常用的色彩坡形方法總結

2D類比實現摩天輪旋轉動畫特效

IE8下的nth-child()相容問題如何處理

CSS3的blur白邊怎麼去除

相關文章

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.