似乎无法找到如何删除两个文本元素之间的垂直空间,该网站上有一些类似的问题,但似乎实际上不起作用。
HTML 代码:
<p>this website is</p> <h1>Encrypted</h1>
似乎我必须使用位置代码,但是当我使用让其他元素靠近它的位置代码时,文本会被推送到网站上的另一个位置
最佳答案
使用 CSS 删除元素之间的空白:
水平存在(顶部和底部空间)
h1, p {
margin-top: 0;
margin-bottom: 0;
line-height: /* adjust to tweak wierd fonts */;
}
垂直存在(左右空间)
.parent {
font-size: 0;
line-height: 0;
}
h1, p {
font-size: 12px;
margin: 0;
display: inline-block;
}
关于html - 删除两个文本元素 <p> 和 <h1> 之间的垂直空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29055488/