[英]Same baseline for independent paragraphs with different font-size
Basically I want to align both lines to appear on the same line, but I really have no idea how to do this properly. 基本上,我想将两条线对齐以显示在同一条线上,但是我真的不知道如何正确执行此操作。 Any help is appreciated, thanks in advance.
任何帮助表示赞赏,在此先感谢。
HTML HTML
<div class="first">
<p>
Lorem<br/>
ipsum<br/>
dolor<br/>
sit<br/>
amet
</p>
</div>
<div class="second">
<p>Align</p>
<p>Multi</p>
<p>
Lines<br/>
And<br/>
Paragraph
</p>
</div>
CSS CSS
div {
float: left;
}
p {
margin: 0;
}
.first {
font-size: 17px;
//...
width: 50px;
}
.second {
font-size: 13px;
}
You can try using the display
attribute to align the two DIVs side by side, this is a very basic example. 您可以尝试使用
display
属性将两个DIV并排对齐,这是一个非常基本的示例。 The margin-right: -4px
is to fix a rendering bug in some browsers where the two DIVs of 50% width in this case won't align properly beside each other. margin-right: -4px
用于修复某些浏览器中的渲染错误,在这种情况下,两个50%宽度的DIV无法正确对齐。
div {
width: 50%;
vertical-align: top;
display: inline-block;
}
p {
margin: 0;
display: block;
}
.second {
margin-right: -4px;
}
If I understand you correctly, you want two columns. 如果我理解正确,则需要两列。 My solution for that is as follows:
我的解决方案如下:
CSS: CSS:
.two-col {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-gap: 1.5rem;
-moz-column-gap: 1.5rem;
column-gap: 1.5rem
}
HTML: HTML:
<div class="two-col">
<p>
Lorem<br/>
ipsum<br/>
dolor<br/>
sit<br/>
amet
</p>
<p>Align</p>
<p>Multi</p>
<p>
Lines<br/>
And<br/>
Paragraph
</p>
</div>
Of course you will need to adjust according to your needs regarding column gap. 当然,您将需要根据有关色谱柱间隙的需要进行调整。 etc.
等等
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.