实现效果:
屏幕缩小至900以下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.parent {
width: 100%;
background: pink;
}
.box {
width: 1140px;
margin-left: auto;
margin-right: auto;
display: flex;
flex-direction: row;
background: yellow;
margin-bottom: 10px;
}
.left {
width: 200px;
height: 200px;
background-color: red;
}
img {
width: 100%;
height: 100%;
}
.right {
flex-grow: 1;
margin-left: 10px;
background-color: lime;
}
@media screen and (max-width: 900px) {
.box {
width: 200px;
background: red;
flex-direction: column;
}
.right {
margin-left: 0;
}
</style>
</head>
<body>
<div class="parent">
<div class="box">
<div class="left">
<img src="1.jpg" alt="">
</div>
<div class="right">
dcwegeftyru7yij78
</div>
</div>
<div class="box">
<div class="left">
<img src="1.jpg" alt="">
</div>
<div class="right">
dcwegeftyru7yij78
</div>
</div>
</div>
</body>
</html>