Html Can';I don’我似乎无法得到我想要的行距

Html Can';I don’我似乎无法得到我想要的行距,html,css,Html,Css,我已经做了很多看起来更复杂的事情,我想这将是简单的一点,但我只是不知道我会错在哪里 我有一个进度条,希望上面有一些文字,离进度条很近。如果我只使用带after的纯文本,文本就是我想要的,但是我想使用css来格式化这些标题。当我这样做时,即使我在css中将行高度设置得很低,我似乎也无法将行间距降得足够低 <h5 id="bar1Title"></h5><h5 id="bar1Title2"></h5> <progress id="bar1" v

我已经做了很多看起来更复杂的事情,我想这将是简单的一点,但我只是不知道我会错在哪里

我有一个进度条,希望上面有一些文字,离进度条很近。如果我只使用带after的纯文本,文本就是我想要的,但是我想使用css来格式化这些标题。当我这样做时,即使我在css中将行高度设置得很低,我似乎也无法将行间距降得足够低

<h5 id="bar1Title"></h5><h5 id="bar1Title2"></h5>
<progress id="bar1" value="30" max="255"></progress>

另外,我想把bar1Title和bar1Title放在同一行,这是另一个我似乎无法完成的简单任务


<h5 id="bar1Title" style="margin-bottom:-2px;"></h5><h5 id="bar1Title2" style="margin-bottom:-2px;"></h5>
<progress id="bar1" value="30" max="255"></progress>

尝试使用style=“margin bottom:-2px;”并根据需要增加px的值,使其向下移动

h5是块级元素。。因此,如果希望这些元素并排显示,则需要显式地为它们设置display:inline

h5
{
    display : inline;
}
此外,如果线条高度不起作用,您还可以调整边距属性并将其设置为负值。

这样可以吗

<div>
    <span id="bar1Title">111</span>
    <span id="bar1Title2">222</span>
</div>
<div style="line-height: 0px;margin-top: -3px;">
    <progress id="bar1" value="30" max="255"></progress>
</div>

111
222
还是这个

<h5 id="bar1Title" style="display: inline">111</h5>
<h5 id="bar1Title2" style="display: inline">222</h5>
<div style="line-height: 0px;margin-top: -3px;">
    <progress id="bar1" value="30" max="255"></progress>
</div>
111
222

< /> > 标题标签有一些默认的边距,您需要考虑。p>

你必须清除这个空白

<h5 style="margin: 0px;"></h5>


尝试使用或其他类似的标记,而不是h1-5。我会将它们包装在一个或标记中,然后设置样式。是否将文本放入标记中?清除结束标记:)显示:内联工作正常,解决了这两个问题。非常感谢!谢谢,那很有用。