在我正在处理的 html 页面的文章部分中,图像和边框之间有一个小间隙。
这是 HTML
<article>
<section class="image">
<a href=""><img src="images/Thumbnail.gif" height="150" width="150" alt=""/></a>
</section>
<aside class="textBox">
<h3>Project</h3>
<p>description</p>
</aside>
</article>
这是CSS(有一些多余的部分我现在正在删除它们)
@charset "UTF-8";
body {
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
background-color: #64748B;
padding: 4em;
color: #000;
background-image: url("images/background.png");
background-repeat: no-repeat;
background-position: top absolute;
background-size: cover;
display: flex;
flex-direction: row;
flex-wrap: wrap
}
H1 {
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
color: #fff;
float: right;
margin-right: 1em;
font-size: 40pt;
}
.NavUl {
margin-top: 5px;
font-weight: bold;
text-align: center;
width: 100%;
}
td {
background-color: #000;
border: 5px outset;
border-color: #22222B
}
.textBox {
height: 150px;
color: #ffffff;
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
padding-left: 1em;
}
header {
background-color: #090B16;
width: 100%;
border: 6px outset #22222B;
}
article {
margin-top: 5px;
margin-bottom: 5px;
display: flex;
background-color: #090B16;
border: 6px outset #22222B;
padding: 0
}
a:link, a:visited {
text-decoration: none;
color: #fff;
}
.logo {
padding: 1em;
}
p {
font-size: 12pt;
}
.image {
padding: 0;
margin: 0;
border: 6px inset #7079B1
}
.post {
width: 100%;
}
我不知道这是否有什么不同,但我使用 adobe dream weaver(我讨厌它,VSC 优越性)
我尝试过调整填充、边距以及高度,可惜这些都没有产生任何影响。
我在你的
height:150px
CSS中添加了.image
,它似乎删除了底部的空格。
@charset "UTF-8";
body {
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
background-color: #64748B;
padding: 4em;
color: #000;
background-image: url("images/background.png");
background-repeat: no-repeat;
background-position: top absolute;
background-size: cover;
display: flex;
flex-direction: row;
flex-wrap: wrap
}
H1 {
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
color: #fff;
float: right;
margin-right: 1em;
font-size: 40pt;
}
.NavUl {
margin-top: 5px;
font-weight: bold;
text-align: center;
width: 100%;
}
td {
background-color: #000;
border: 5px outset;
border-color: #22222B
}
.textBox {
height: 150px;
color: #ffffff;
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
padding-left: 1em;
}
header {
background-color: #090B16;
width: 100%;
border: 6px outset #22222B;
}
article {
margin-top: 5px;
margin-bottom: 5px;
display: flex;
background-color: #090B16;
border: 6px outset #22222B;
padding: 0
}
a:link, a:visited {
text-decoration: none;
color: #fff;
}
.logo {
padding: 1em;
}
p {
font-size: 12pt;
}
.image {
height: 150px;
padding: 0;
margin: 0;
border: 6px inset #7079B1
}
.post {
width: 100%;
}
<article>
<section class="image">
<a href=""><img src="https://placehold.jp/150x150.png" height="150" width="150" alt=""/></a>
</section>
<aside class="textBox">
<h3>Project</h3>
<p>description</p>
</aside>
</article>