0

这是我博客中的一个页面。我创建了一个名为Journal entries
的灰色框。

Point 1 读作For recording...
如您所见,以 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.&nbsp;</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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...Dr.
                <br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;To Asset A/c</div>

            <br>

            <div style="float: left;">2.&nbsp;</div>
            <div>For recording 2<sup>nd</sup> aspect, the depreciation for the period is transferred to the Profit &amp; Loss Account:</div>
            <div style="margin-left: 20px;">Profit and Loss A/c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...Dr.
                <br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;To Depreciation A/c</div>

        </div>


    </div>
</div>
4

2 回答 2

0

根据您的评论,您根本不希望文本低于数字。一种选择是将数字放在文本中div,然后将其绝对放置在角落。然后在 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;
}

http://jsfiddle.net/THYga/1/

于 2013-10-28T15:02:41.573 回答
0

使用SPAN代替DIV元素。如果您无法更改 html,则使用 CSS分配display: inline给这些元素。DIV也不要使用float: left编号元素。

于 2013-10-28T15:01:14.410 回答