2016-06-26 40 views

回答

0

您可以旋轉添加到容器:

.pic { 
 
    overflow: hidden; 
 
} 
 

 
.grow img, .grow { 
 
    height: 300px; 
 
    width: 300px; 
 
    
 
    -webkit-transition: all 1s ease; 
 
    -moz-transition: all 1s ease; 
 
     -o-transition: all 1s ease; 
 
     -ms-transition: all 1s ease; 
 
      transition: all 1s ease; 
 
} 
 
.grow:hover { 
 
    transform:rotate(15deg); 
 
} 
 
.grow:hover img { 
 
    width: 400px; 
 
    height: 400px; 
 
} 
 

 

 
/* DEMO PURPOSE */ 
 
html { 
 
    height:100%; 
 
    display:flex; 
 
    align-items:center; 
 
    justify-content:center; 
 
    }
<div class="grow pic"> 
 
    <img src="http://lorempixel.com/400/400/people/9" alt="portrait"> 
 
</div>
或僅僅是形象? 另外,變換既可以做(變焦&旋轉)

.pic { 
 
    overflow: hidden; 
 
} 
 

 
.grow img, .grow { 
 
    height: 300px; 
 
    width: 300px; 
 
    
 
    -webkit-transition: all 1s ease; 
 
    -moz-transition: all 1s ease; 
 
     -o-transition: all 1s ease; 
 
     -ms-transition: all 1s ease; 
 
      transition: all 1s ease; 
 
} 
 

 
.grow:hover img { 
 
    transform:rotate(15deg) scale(1.25); 
 
} 
 

 

 
/* DEMO PURPOSE */ 
 
html { 
 
    height:100%; 
 
    display:flex; 
 
    align-items:center; 
 
    justify-content:center; 
 
    }
<div class="grow pic"> 
 
    <img src="http://lorempixel.com/400/400/people/9" alt="portrait"> 
 
</div>

+0

工作就像一個魅力!謝謝 – FrantisekNebojsa

0

HTML:

<div id="container"> 
<img src="picture.jpg" id="picture" /> 
</div> 

的CSS:

#container{ 
overflow:hidden; 
width:100px; 
height:100px; 
} 
#picture{ 
height:300px; 
width:300px; 
}