html - 如何将div中的内容居中

标签 html css

我试图将标签的内容居中。这是我要居中的 div:

<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>

肯定有一些我遗漏的东西,但我没有想法。

最佳答案

只是使用

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

Live Demo

关于html - 如何将div中的内容居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19642037/

相关文章:

html - 删除 Canvas 元素下的空间?

javascript - 幻灯片和缩放功能不再适用于获取内容

jquery - 如何在jquery中点击添加类和滑动切换

javascript - 第二次悬停时出现 Div

html - 如何创建没有左右边框的列表 HTML CSS

css - 表格单元格 div 的透明度

jquery - 单选按钮将值发送为 Male=on 或 Female=on。我只想将 Male/Female 发送到数据库

html - LESS:在 :before 中使用 font-awesome

html - 跨单元干扰 td :nth-child(even) logic

javascript - 有没有办法让我的搜索结果列表一次只显示一个结果?