【问题标题】:How to center the caption of a grid如何使网格的标题居中
【发布时间】:2012-04-24 12:31:35
【问题描述】:

如何在不更改 css(全局)的情况下使网格的标题居中? 默认情况下,标题在左侧。

【问题讨论】:

    标签: jqgrid


    【解决方案1】:

    我认为标题居中的代码可能是以下内容

    $("#grid").closest("div.ui-jqgrid-view")
        .children("div.ui-jqgrid-titlebar")
        .css("text-align", "center")
        .children("span.ui-jqgrid-title")
        .css("float", "none");
    

    the demo:

    【讨论】:

    • @Bertaud:这个问题需要时间,但我这周很忙。 :-(
    • @Oleg 你能帮我解决这个问题吗stackoverflow.com/questions/10361083/…,谢谢
    • @user2334092:不客气!您可以只使用 caption 值作为 HTML 片段和另一个字体大小,如 caption: '<span style="font-size:20px">Demonstrate how to center the title of the grid</span>'
    • @user2334092:您应该将答案中的建议(标题居中)与caption: "<span style="font-size:20px">Demonstrate how to center the title of the grid</span>" 的用法(更改网格标题的字体大小)结合起来
    【解决方案2】:

    这个问题被提出和回答已经有一段时间了。另一种方法是:

    <style>
    .ui-jqgrid-caption {
      text-align:center !important;
    }
    </style>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-30
      • 2012-02-06
      • 2018-04-23
      • 2018-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多