在我的公司,我们有一个使用 Iframe 来呈现内容的 Web 应用程序。内容是 xml,转换为 html,然后放置在 Iframe 中( super 简化)。我们希望从 iframe 转向 div,但内容有自己的 css。我听说 Iframe 会忽略父级 css。
我们需要废除 Iframe,如何在不使用 IFrame 的情况下忽略所有父级 css
最佳答案
你不能忽略父级的 css
使用包装器 div
而不是 iframe
并通过添加包装器的 id
或 class
覆盖内部前 iframe css > 在每种样式之前。
之前:
.table{
background-color: #000;
}
之后:
#wprapper .table{
background-color: #000;
}
或者:
.wrapper .table{
background-color: #000;
}
关于css - Div 在不使用 IFrame 的情况下忽略所有父级 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22505619/