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

<!DOCTYPEhtml>

<html>

<head>

<matacharset="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>

<divid="images">

<divid="image">

<imgsrc="images/third.jpg">

</div>

<divid="image">

<imgsrc="images/third.jpg">

</div>

</div>

</body>

</html>

相关推荐