0

I am trying to center the contents of a tag. This is the div that I am trying to center:

<div class="Paging" style="margin: 0 auto;">
    <div class="PageOfPage" style="display:inline-table;padding: 10px;">

        Page<label id="CurrentPage">1</label> From @Model.CountPage
    </div>
    <div class="RecordsOfRecord" style="display:inline-table;padding: 10px;">
        Record
        <label id="FromRecord">
            @{
                 int i1 = (Model.CurrentPage-1)*Model.CountRecordInPage;
                 if (i1 == 0)
                 {
                     i1 = 1;
                 }

                 string recordFrom = i1.ToString(CultureInfo.InvariantCulture);
             }@recordFrom
        </label>
        To
        <label id="ToRecord">@Model.CountRecordInPage</label>
        From @Model.AllRecord
    </div>
</div>

There must be something that I am missing, but I am out of ideas.

4

3 回答 3

3

只需使用

<div class="Paging" style="margin: 0 auto; text-align:center;">

Live Demo

于 2013-10-28T18:15:18.340 回答
0

如果要使用边距,请给出 div 的宽度:auto

.Paging {
width :70%;
margin : auto;

}
于 2013-10-28T18:17:49.930 回答
0

为 div 添加宽度!或者如果您希望文本居中添加 text-align:center;

于 2013-10-28T18:52:39.313 回答