gpt4 book ai didi

html - 覆盖自定义控件的 CSS 样式

转载 作者:太空宇宙 更新时间:2023-11-04 13:49:22 26 4
gpt4 key购买 nike

我有一个自定义创建的表格,并通过 CSS 在 .ascx 中设置了样式。见下文:

<style>

.divTable {
display: block;
height: auto;
width: calc(100% - 25%);
font: normal 12px/150% Arial, Helvetica, sans-serif;
overflow: hidden;
text-align: left;
}

.divBody {
position: relative;
height: calc(100% - 42px);
border: 2px solid #000000;
font-size: 12px;
font-weight: normal;
top: 0px;
left: 0px;
right: 0px;
overflow-x: scroll;
overflow-y: scroll;
color: #383838;
width: auto;
height: 500px; -- this is the one I am trying to get to be the custom height; either 500px if on a view tab or auto if on another tab.
}
....
</style>

现在,这是在名为 DataGridForDetails 的自定义控件中。当我把它带到“VIEW”页面时,它会完美地列出所有内容,看起来很棒。但是,我有一个“详细信息”工作表,该控件被重新用于其他数据,这些数据可能有也可能没有表中的元素(即用户单击 View 中的一行,将它们带到详细信息页面其中有 2 个数据网格显示 Assets 成本和时间表成本)。

我希望能够重新使用此数据网格,以便它在 View 选项卡上“可以”为 500 像素高度,但是,当它在其他页面上时为自动高度。

有什么办法吗?我试过使用 !important.style1.style2。除了纯粹为其他页面创建新控件之外的一切(也许这就是需要做的事情?)。

干杯。

最佳答案

一个建议

  1. 使用 div 和表格设计您喜欢的用户控件
  2. 为 View 选项卡创建一个单独的 css 文件
  3. 为其他页面创建不同的 css 文件

并在 css 中使用 id 选择。那就是使用 #div 、 #Table 等。所以它会影响该页面上的所有 div。

小心地将 css 应用到各个页面。

我不确定这是最好的方法。

关于html - 覆盖自定义控件的 CSS 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22314657/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com