这是来自 my blog 的页面.
我创建了一个名为 Journal entries 的灰色框。
第 1 点读作用于记录...
如您所见,从单词 For 开始的文本略低于数字 1 的级别。
第 2 点也是如此。
请建议我应该对代码进行哪些更改。
我的代码:
<div style="background-color: #F0F0F0; display: table-cell; vertical-align: middle; border-radius: 15px;">
<div style="margin-left: 10px; margin-right: 100px; margin-top: 15px; margin-bottom: 15px;">
<div style="text-align: center;"><span style="font-family: georgia; font-size: 17px; font-weight: bold;">Journal entries</span></div>
<br>
<div style="font-family: serif; font-size: 17px; margin-left: 30px;">
<div style="float: left;">1. </div>
<div>For recording 1<sup>st</sup> aspect, asset value is reduced period-wise by crediting its account:</div>
<div style="margin-left: 20px;">Depreciation A/c ...Dr.
<br>
To Asset A/c</div>
<br>
<div style="float: left;">2. </div>
<div>For recording 2<sup>nd</sup> aspect, the depreciation for the period is transferred to the Profit & Loss Account:</div>
<div style="margin-left: 20px;">Profit and Loss A/c ...Dr.
<br>
To Depreciation A/c</div>
</div>
</div>
</div>
最佳答案
根据您的评论,您根本不希望文本低于数字。一种选择是将数字放在文本 div
中,然后将其绝对放在 Angular 落。然后向 div 添加一些填充以移动文本。:
<div class="text">
<div class="num">
1.
</div>
stuff
</div>
.text{
position: relative;
padding-left: 20px;
}
.num{
position: absolute;
width: 20px;
top: 0;
left: 0;
}
关于css - 如何对齐 2 个并排 Div 的基线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19638092/