gpt4 book ai didi

css - 如何删除css中的空格?

转载 作者:太空宇宙 更新时间:2023-11-04 09:44:45 25 4
gpt4 key购买 nike

我需要删除线条和图片之间的空格。在屏幕截图中可以看到,在该行的底部一切正常,但在顶部,有一个空格。它设置在 .about_img:after (css 文件)我做错了什么?

enter image description here

代码如下:

.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}

.clearfix:after {
clear: both;
}
.left {
float: left;
}
.right {
float: right;
}
h5.title {
margin-bottom: 10px;
font: 18px/18px Arial, sans-serif;
font-weight: bold;
color: #222222;
}
#about{
text-align: center;
}
.about-wrap{
margin-left: 16%;
margin-top: 70px;
}
.about_text{
width: 30%;
text-align: right;
}
.about_right{
text-align: left;
float: right;
}
.about_img{
width: 20%;
}
.about_img:after{
content: '';
display: block;
margin: 0 auto;
height: 94px;
width: 3px;
background: #f1f1f1;
}
.about_img img{
display: inline-block;
width: 170px;
height: 170px;
border: 7px solid #f1f1f1;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
}

.move_left_p{
margin-right: 20%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PSD to HTML</title>
<link type="text/css" rel="stylesheet" href="css/reset.css"/>
<link type="text/css" rel="stylesheet" href="css/index.css"/>
</head>
<body>

<div id="wrapper">
<div id="about" name="about" class="box">
<div class="about-wrap">
<div class="about_item clearfix">
<div class="about_text left">
<h5 class="title"><span>July 2010</span> <br/>Our Humble Beginnings</h5>
<p>Proin iaculis purus consequat sem cure
digni ssim.
</p>
</div>
<div class="about_img left">
<img src="img/about_item1.png" alt=""/>
</div>
</div>
<div class="about_item clearfix move_left">
<div class="about_text right about_right move_left_p">
<h5 class="title"><span>January 2011</span><br/>
Facing Startup Battles</h5>
<p>Proin iaculis purus consequat sem cure
digni ssim.</p>
</div>
<div class="about_img right">
<img src="img/about_item2.png" alt=""/>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

最佳答案

尝试以下操作:

 .about_img:after{
margin: -5px auto 0 auto;
}

关于css - 如何删除css中的空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39573186/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com