gpt4 book ai didi

html - 使用 CSS 将两个标题彼此靠近对齐

转载 作者:行者123 更新时间:2023-11-28 04:13:20 26 4
gpt4 key购买 nike

我有两条线,它们之间有空格。就像下面的....

 <h2> Something Something <h2>



<h4> Something here too </h4>

我希望它看起来像这样:

 <h2> Something Something <h2>
<h4> Something here too </h4>

空间显示在浏览器中。我使用标签只是为了清楚。

enter image description here

如何缩小橙色矩形内的空间?

最佳答案

首先,确保标题元素上的 paddingmargin 为 0。

之后,您可以调整它们的 line-height 值以获得您喜欢的空间量。示例:http://jsbin.com/afivoq/4/edit

您的另一种选择!您可以在其他标题元素之后的标题元素上应用负 margin-top,如下所示:

h2 + h4 { margin-top: -20px; }

请参阅 jsbin 以获取更新的示例。

关于html - 使用 CSS 将两个标题彼此靠近对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12429677/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com