是否可以在不注释的情况下使 div 不可见?如果是,怎么办?
最佳答案
你需要用 CSS 隐藏它:
div { /* this will hide all divs on the page */
display:none;
}
如果它是具有特定类或 id 的特定 div,您可以像这样隐藏它:
<div class="div_class_name">Some Content</div>
CSS:
div.div_class_name { /* this will hide div with class div_class_name */
display:none;
}
或者
<div id="div_id_name">Some Content</div>
CSS:
div#div_id_name { /* this will hide div with id div_id_name */
display:none;
}
注意:您需要将 CSS 样式包装在 <style type="text/css"></style>
之间标签,示例:
<style type="text/css">
div#div_id_name {
display:none;
}
</style>
关于css - 如何在不注释掉的情况下使div不可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3028025/