我支持遗留应用程序。
在CSS中有如下规则:
.dashboard-panel table {
width: 100%;
}
所以基本上有很多面板,对于其中的所有表格,宽度
都设置为 100%
。
现在的问题是:在仪表板面板中,我放置了一个来自外部库 (richfaces) 的日历控件。此日历控件使用表格来显示日期。而这个 width:100%
正在影响日历表。
例子:
<div class="dashboard-panel">
<div id="content">
<table id="table1"> //this is ok
<tr>
<td>
<table id="richfacesCalendarTable"> //this not ok
</table>
</td>
</tr>
</table>
</div>
</div>
这里的正确解决方案是什么?
我不想遍历此应用程序中的每个面板并在其中放置一个单独的样式。
最佳答案
Mabye 如果你在你的 css 末尾添加类似的东西:
.dashboard-panel table#richfacesCalendarTable {
width: your_desired_width_px !important;
}
或
.dashboard-panel table#richfacesCalendarTable {
width: auto !important;
display: table !important;
}
很难确定,因为这只是您提供的 HTML 和 CSS 代码的一小部分。可能还有其他因素会影响您的结果。
关于CSS 表格宽度规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14434765/