使用css在树结构内部到达html div

问题描述 投票:0回答:3

我有以下html结构(在wiki-content div中),我不知道如何到达它。

enter image description here

这似乎不起作用,你知道为什么吗?

.wiki-content .table-wrap relative-table.wrapped.confluenceTable
{
   width: 100%;
 }

谢谢

html css css-selectors
3个回答
3
投票

它不起作用,因为你有一个宽度设置为99.9315%的内联CSS值。内联样式在css之后得到处理,因此这将覆盖css文件中任何其他宽度设置。

尝试删除内联宽度设置。


1
投票

你尝试过使用!important吗?

.wiki-content .table-wrap relative-table.wrapped.confluenceTable
{
   width: 100% !important;
}

1
投票

您可以尝试这样做,并尝试将!important覆盖现有宽度。

.table-wrap .relative-table.wrapped.confluenceTable
{
   width: 100%!important;
}

如果内联样式宽度是由某个javascript生成的,则需要使用javascript重新初始化它。因为你不能使用css覆盖内联样式,因为它具有最大的特异性值。请阅读此链接关于https://css-tricks.com/specifics-on-css-specificity/

请参阅下面的javascript代码重新初始化宽度。

document.getElementsByClassName("relative-table").style.width = "100%";
© www.soinside.com 2019 - 2024. All rights reserved.