18910140161

h 标签前面添加自定义标签之后显示一段空白是为什么?

顺晟科技

2022-09-16 07:28:56

213

求助 h 标签前面添加自定义标签之后显示一段空白。

就是上面这样,怎样才能去掉那段空白。自定义标签是这样的:<hbe-prefix></hbe-prefix>没有宽度和高度。

我已经解决了这个问题。这个方法看起来比较笨,但它起到了作用。使用 nth-child(2) 对首次出现的 h 标签强制清除浏览器作出的行动。

#post h1:nth-child(2) {
    margin-block-start: 0em !important;
}
#post h2:nth-child(2) {
    margin-block-start: 0em !important;
}
#post h3:nth-child(2) {
    margin-block-start: 0em !important;
}
#post h4:nth-child(2) {
    margin-block-start: 0em !important;
}
#post h5:nth-child(2) {
    margin-block-start: 0em !important;
}
#post h6:nth-child(2) {
    margin-block-start: 0em !important;
}

看上去是 margin,之前应该是触发 margin 合并了

*{padding:0;margin:0;} 试试

相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航