提问者:小点点

如何只在段落之间设置边距?[副本]


有一个区块是这样的:

<div>
  <p>Hello.</p>
  <p>How are you?</p>
</div>

我想在“你好”之间设置空白点。还有“你好吗?”为16px,但

和其内部

边框之间的边距为0px。


共1个答案

匿名用户

我想这能帮到你。

null

div p {
    margin-bottom: 16px;
}
div p:last-child {
    margin-bottom: 0;
}
<div>
  <p>Hello.</p>
  <p>How are you?</p>
  <p>I am fine</p>
  <p>And you?</p>
</div>