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

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

作者: aguige | 来源:发表于2018-05-22 10:31 被阅读0次
<!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> 

相关文章

网友评论

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

      本文链接:https://www.haomeiwen.com/subject/pmchjftx.html