请老师检查代码是否正确
来源:4-10 自由编程
DanteSu
2021-08-12 22:10:25
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin:0;
padding:0;
}
.main{
width: 100%;
}
.m1{
float: left;
width: 25%;
height: 380px;
margin-right:0;
}
img{
display: block;
width: 100%;
}
.m2{
float: left;
width: 25%;
height: 380px;
background: #07cbc9;
}
.p1{
font-size: 24px;
padding-top: 20px;
margin-bottom: 30px;
padding-left: 20px;
}
.p2{
font-size: 16px;
color: white;
margin-bottom: 20px;
padding-left: 20px;
}
.p3{
font-size: 14px;
color:gray;
margin-bottom: 30px;
padding-left: 20px;
}
input{
display: block;
width: 138px;
height: 40px;
border: none;
color: white;
background-color: black;
line-height: 40px;
margin: 0 auto;
}
</style>
</head>
<body>
<div class='main'>
<div class="m1">
<img src="./images/b1.jpg" alt="">
</div>
<div class="m2">
<p class="p1">Library</p>
<p class="p2">Lorem Ipsum is simply dummy text of the printing and typesetting
industry</p>
<p class="p3">
Lorem Ipsum has been the industry's standard dummy text ever since
the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book.
</p>
<input type="submit" value="EXPLORE">
</div>
<div class="m1">
<img src="./images/b2.jpg" alt="">
</div>
<div class="m2">
<p class="p1">Library</p>
<p class="p2">Lorem Ipsum is simply dummy text of the printing and typesetting
industry</p>
<p class="p3">
Lorem Ipsum has been the industry's standard dummy text ever since
the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book.
</p>
<input type="submit" value="EXPLORE">
</div>
<div class="m2">
<p class="p1">Library</p>
<p class="p2">Lorem Ipsum is simply dummy text of the printing and typesetting
industry</p>
<p class="p3">
Lorem Ipsum has been the industry's standard dummy text ever since
the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book.
</p>
<input type="submit" value="EXPLORE">
</div>
<div class="m1">
<img src="./images/b3.jpg" alt="">
</div>
<div class="m2">
<p class="p1">Library</p>
<p class="p2">Lorem Ipsum is simply dummy text of the printing and typesetting
industry</p>
<p class="p3">
Lorem Ipsum has been the industry's standard dummy text ever since
the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book.
</p>
<input type="submit" value="EXPLORE">
</div>
<div class="m1">
<img src="./images/b4.jpg" alt="">
</div>
</div>
</body>
</html>
1回答
好帮手慕星星
2021-08-13
同学你好,可以看到有图片超出了

这是电脑分辨率的原因,图片设置宽度为100%,高度会按照自身宽高比进行显示。如果分辨率越大,25%计算宽度也越大,所以图片宽度越大,高度也就越大,导致超出。
建议设置图片固定高度

其他样式是可以的,祝学习愉快!
相似问题