1

我有两个 DataGrid 表,我想制作 200px 高,但有些东西覆盖了我的 css 中的高度。目前,表格在显示时是两种完全不同的尺寸。

表:

<table  dojoType="dojox.grid.DataGrid" id="dnToCountDiv" data-dojo-id="dnToCountDiv" columnReordering="true"
                            sortFields="['extension','totalcalls','totaloutboundcalls','internaloutboundcalls','localoutboundcalls','longdistanceoutboundcalls','internationaloutboundcalls','totalinboundcalls','inboundinternalcalls','inboundexternalcalls']"
                            rowWidth="100%"
                            noDataMessage="<span class='dojoxGridNoData'>No Calls to Show</span>"
                            class="statisticsTable">
                        <thead>
                            <tr>
                                <th field="extension" width="100%" >Extension</th>
                                <th field="totalcalls" width="100%" >Total</th>
                                <th field="totaloutboundcalls" width="100%" > Total Out</th>
                                <th field="internaloutboundcalls" width="100%" >Internal Out</th>
                                <th field="localoutboundcalls" width="100%" >Local Out</th>
                                <th field="longdistanceoutboundcalls" width="100%" >Long Dist Out</th>
                                <th field="internationaloutboundcalls" width="100%" >Internat. Out</th>
                                <th field="totalinboundcalls" width="100%" >Total In</th>
                                <th field="inboundinternalcalls" width="100%" >Internal In</th>
                                <th field="inboundexternalcalls" width="100%" >External In</th>
                            </tr>
                        </thead>
                    </table>

                    <!-- dn to call time table -->
                    <h3>Call Time Per Extension
                        <button  data-dojo-type="dijit.form.Button" id="call_time_help_button" data-dojo-props="iconClass: 'helpIconClass'">Column Key
                            <script type="dojo/method" data-dojo-event="onClick" >
                                alert("call Time help pressed");
                            </script>
                        </button></h3>
                    <table  dojoType="dojox.grid.DataGrid" id="dnToTimeDiv" data-dojo-id="dnToTimeDiv" columnReordering="true"
                            sortFields="['extension','totalcalls','totaloutboundcalls','internaloutboundcalls','localoutboundcalls','longdistanceoutboundcalls','internationaloutboundcalls','totalinboundcalls','inboundinternalcalls','inboundexternalcalls']"
                            rowWidth="100%"
                            noDataMessage="<span class='dojoxGridNoData'>No Calls to Show</span>"
                            class="statisticsTable">
                        <thead>
                            <tr>
                                <th field="extension" width="100%" >Extension</th>
                                <th field="totalcalls" width="100%" >Total</th>
                                <th field="totaloutboundcalls" width="100%" > Total Out</th>
                                <th field="internaloutboundcalls" width="100%" >Internal Out</th>
                                <th field="localoutboundcalls" width="100%" >Local Out</th>
                                <th field="longdistanceoutboundcalls" width="100%" >Long Dist Out</th>
                                <th field="internationaloutboundcalls" width="100%" >Internat. Out</th>
                                <th field="totalinboundcalls" width="100%" >Total In</th>
                                <th field="inboundinternalcalls" width="100%" >Internal In</th>
                                <th field="inboundexternalcalls" width="100%" >External In</th>
                            </tr>
                        </thead>
                    </table>

CSS:

.statisticsTable {
width: 800px;
height: 200px;
border-style:solid;
border-width:1px;
border-color:#C1C1C1; 

}

边框等已正确添加,因此它可以看到 CSS。当我打开萤火虫时,虽然我在检查其中一张桌子上的 html 时得到以下信息。它承认 element.style 覆盖了高度。

在此处输入图像描述

我将如何解决这个问题?

谢谢

4

1 回答 1

11

style只能使用 覆盖属性!important

.statisticsTable {
  height: 200px !important;
  /* ... */
}

但是,您应该不惜一切代价避免!important,因为!important只能被!important(困扰整个样式表)覆盖,内联样式只能覆盖!important样式本身!important,并且!important内联样式根本不能被 CSS 覆盖。如果您可以避免创建需要首先覆盖的样式属性,那么您绝对应该这样做。

于 2012-11-17T18:11:17.617 回答