我可以根据样式隐藏 DIV 吗?
我有这个需要隐藏的 div:
<div style="font-family: helvetica, sans-serif; text-align: center; text-transform: uppercase; font-size: 9px; letter-spacing: 2px; font-weight: bold; padding: 3px 0px 5px !important; color: rgb(170, 170, 170) !important; clear: both;">...</div>
谁能给我举个例子
DIV 正在从另一个站点加载,所以我无法直接控制使用“display:none”。
最佳答案
您可以使用 CSS attribute selectors根据 style
属性隐藏该 div 元素。
例如:
div[style^="font-family: helvetica"] {
display: none;
}
或者寻找特定的样式:
div[style*="color: rgb(170, 170, 170)"] {
display: none;
}
关于javascript - 根据DIV样式隐藏没有ID的DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22120310/