我试图按基线对一个页眉与一整套文本进行对齐,但这似乎令人惊讶地证明是困难的。我一直在玩弄不同的方法,但似乎找不到完美的解决办法。下面是下面我所行的一个例子:
“https://i.sstatic.net/4HekG.png' alt=“示例”/>
<h2>XxMmxX</h2>
<p class="right">
I saw for the first time the earth s shape. I could easily see the shores of continents, islands, great rivers, folds of the terrain, large bodies of water. The horizon is dark blue, smoothly turning to black. . . the feelings which filled me I can express with one word—joy.
</p>
样式 :
h2 {
position: relative;
font-size: 24px;
line-height: 40px;
text-align: right;
width: 190px;
top: 30px;
}
.right {
margin-left: 200px;
font-size: 14px;
line-height: 20px;
}
我希望XxMxx的基线与案文的基线保持一致。
一些说明:
- The header is right-aligned and has a fixed width
- The header uses a bigger font-size than body
- I want them to be perfectly aligned, this means not just setting a top of some px and having it almost aligned. (this page will be printed and this will definitely be noticeable)