【发布时间】:2013-05-27 22:06:09
【问题描述】:
谁能给我建议一种不同样式的方法来设置具有相同类的 2 个标签?
我有两张桌子
<table id="tab1" class=".ui-jqgrid .ui-jqgrid-hbox">
<table id="tab2" class=".ui-jqgrid .ui-jqgrid-hbox">
第一个表是页面上的 jqgrid,第二个表标签有 jqgrid,它位于弹出窗口内。现在我想对两个 jqgrids 的顶部(标签/列)行进行不同的样式设置。但每当我申请应用样式
.ui-jqgrid .ui-jqgrid-htable th div {
height: auto;
overflow: hidden;
padding-right: 4px;
padding-top: 2px;
position: relative;
vertical-align: text-top;
white-space: normal !important;
}
它会影响两个表格标签。我希望它影响第一个标签,我想将相同的样式应用于其他表格标签但具有额外的属性。请帮助谢谢
【问题讨论】:
-
您必须在第二个表中找到与第一个表不同的内容。可能是父元素上的一个类。
-
看看
:first-child和:nth-child()选择器:api.jquery.com/first-child-selector -
i have 2 divs但<table id="tab1" class=".ui-jqgrid .ui-jqgrid-hbox">对我来说似乎很合适。 -
@SheikhHeera 我做了更改。感谢您指出
标签: javascript jquery html css jqgrid