css - 如何在不注释掉的情况下使div不可见?

标签 css html

是否可以在不注释的情况下使 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>

More Information :)

关于css - 如何在不注释掉的情况下使div不可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3028025/

相关文章:

css - Sass 在没有 parent 的情况下获得当前类(class)

html - 掩蔽 - 仅在特定 div 顶部显示 div?

html - IE6 和 IE7 中的绝对位置无法正常工作

Javascript - 创建的第二个对象与第一个对象不同

javascript - 如何通过定位内部 html 按钮标签 "data-content"自动淡出 popover()

jQuery 干扰 CSS 背景图片位置?

css - 如何在 Flexbox 中制作嵌套的可滚​​动容器?

css - 使用 :target pseudo-class 时出现打印问题

javascript - 如何将垂直选项卡式内容面板更改为响应式可折叠媒体查询和 jquery?

javascript - 随内容增加元素宽度,否则宽度相等 - CSS