【发布时间】:2016-06-24 16:26:48
【问题描述】:
您知道有一种方法可以完全清除母版页中的<nav class="navClass">,或者用<nav> (no content, no styling in between) </nav> 替换它吗?
我试过了
<style>
.navClass { width: 0px !important; }
</style>
这仅对样式生效,但如果我在两者之间有文本,它将不会被删除。
我已经在 c# 中通过在母版页上设置条件解决了这个问题。
<% if ( // condition to not apply for child of certain type { %>
//here, original definition with content and style
<% } %>
但我想知道是否有更有效的方法可以直接用于子级删除nav,在c# 或css 中,避免使用javascript。
也许我可以在 master 中为它分配 ID 并用它在 child 中覆盖它?
谢谢!
【问题讨论】: