css控制图片不改变原比例居中显示,图片超出div部分隐藏

2018-05-22  本文已影响0人  aguige
<!DOCTYPE html>    
<html > 
<head> 
<mata charset ="UTF-8"></mata> 
<style> 
#images{ 
display:flex; 
flex-direction:row; 
} 
#image{ 
width:200px; 
height: 200px; 
overflow:hidden; 
display: flex; 
  justify-content: center; 
  align-items: center;  
} 
img{ 
width:auto; 

height:200px; 
} 
</style> 
</head> 
<body> 
<div id = "images"> 
<div id = "image"> 

<img src ="images/third.jpg" > 

</div> 
<div id = "image"> 

<img src ="images/third.jpg" > 

</div> 
</div> 
</body> 
</html> 

上一篇 下一篇

猜你喜欢

热点阅读