为什么 blockquote 在它的末尾添加了一个额外的 br,我该如何避免它? 我怎样才能删除添加的额外 br 以便我的所有行都在一起>
.container-content .main-content .container-test pre {
font-family: monospace;
white-space: pre;
word-break: break-all;
color: #ececec;
border: none;
padding: 0;
background-color: transparent;
}
blockquote {
padding: 0px 10px 0px;
margin: 0 0 0px;
border-left: 3px solid #2471A3;
}
<div class="container-test">
<pre>
test test tesst
test test tesst
test test tesst
test test tesst
<blockquote>test test tesst
test test tesst
test test tesst
test test tesst</blockquote>
test test tesst
test test tesst
test test tesst
test test tesst
</pre>
</div>
最佳答案
为什么你有一个额外的br
的原因在你的 block 引用之后是因为你正在使用 <pre>
标签。 pre
标记格式的文本与您在代码中的编写方式完全相同。所以这里有两个解决方案
- 按照您希望的方式格式化代码
.container-test {
font-family: monospace;
}
blockquote {
padding: 0px 10px 0px;
margin: 0 0 0px;
border-left: 3px solid #2471A3;
}
<div class="container-test">
<pre>
test test tesst
test test tesst
test test tesst
test test tesst
<blockquote>test test tesst
test test tesst
test test tesst
test test tesst</blockquote>test test tesst
test test tesst
test test tesst
test test tesst
</pre>
</div>
- 避免使用
pre
完全,并为您的容器添加宽度。
.container-test {
font-family: monospace;
width: 150px;
}
blockquote {
padding: 0px 10px 0px;
margin: 0 0 0px;
border-left: 3px solid #2471A3;
}
<div class="container-test">
test test tesst
test test tesst
test test tesst
test test tesst
<blockquote>
test test tesst
test test tesst
test test tesst
test test tesst
</blockquote>
test test tesst
test test tesst
test test tesst
test test tesst
</div>
您可以阅读有关 pre
的更多信息标签 here .
关于css - Blockquote 添加了额外的 <br>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48141364/