html - 相同的行高

标签 html css

我希望所有行之间的行高相同,这可能吗(考虑到我将所有行指定为 0.99em)。 P标签和UL标签之间的空间也必须是0.99em。 P tag 和 P tag 之间的空间也必须是 0.99em。这可能吗?

请在此处查看 Bootply... http://www.bootply.com/AIcBXdqs6t

代码:

HTML

<p><span>7.1</span> this is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is itthis is it.</p>
<p><span>7.2</span> here we gohere we gohere we gohere we gohere we gohere we gohere we gohere we gohere we gohere we gohere we gohere we gohere we gohere we go.</p>
<p><span>7.3</span> now toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow toonow too</p>
<ul>
<li>(a) why why why whywhy whywhy whywhy whywhy whywhy whywhy whywhy why</li>
<li>(b) if if ifif if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if  </li>
<li>(c) please pleasepleasepleasepleasepleasepleasepleasepleasepleasepleasepleasepleasepleasepleasepleaseplease</li>
</ul>
<p><span>8.1</span> Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.Take this.</p>
<p><span>8.2</span> Take this.Take this.this.Take this.Take this.Take this.this.Take this.Take this.Take this.Take this.Take this.</p>

CSS:

/* CSS used here will be applied after bootstrap.css */

p {
    padding-left: 3em;
    position: relative;
    margin-left:5em;
    margin-right:5em;
    line-height:0.99em;
}

p > span {
    display: inline-block;
    left: 0;
    position: absolute;
    top: 0; 
    width: 3em
}

ul {
    list-style: none;
    text-indent:-0.5em;
    margin-left:7em;
    margin-right:4em;
    line-height:0.99em;
}

最佳答案

发布评论中的答案。

line-height 属性用于设置标签中行的高度,这样两行段落的每一行都会有一些设置的高度值。将其视为标签内的高度。

标签之间的间距不是行高属性。在您的情况下,标签之间有空格,因为 margin-bottom: 10px 应用于它。

关于html - 相同的行高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30793024/

相关文章:

javascript - HTML5 Web Workers 在 Firefox 4 中工作,但在 Chrome 12.0.742.122 中不工作

html - 打印预览和打印只打印我网页的一部分

html - 单个模态的 ionic 3 模态全屏宽度/高度?

css - CSS中心显示内联 block ?

html - 居中响应标题 - wordpress 博客

html - 使用溢出自动并排 float 文本

html - 如何让我的标签从中间打开,而不是从左边打开?

css - 使用元素内保存的图像名称 - XML/CSS

html - 为应用整个页面的正文提供背景颜色。为什么?

javascript - HTML 表单提交到数据库并重定向到感谢页面