美文网首页
隐藏盒子

隐藏盒子

作者: Yuann | 来源:发表于2017-10-13 22:00 被阅读0次
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div class="box"></div>
<script>
    //获取盒子,设置样式
    var box = document.getElementsByClassName("box")[0];
//    box.style.width = "100px";
//    box.style.height = "100px";
//    box.style.backgroundColor = "pink";
        box.style.cssText = "width:100px;height:100px;background-color:red";

    //隐藏盒子
    box.onclick = function () {
        this.style.display = "none";
//        this.style.visibility = "hidden";
        this.style.opacity = "0";
//        this.style.position = "absolute";
//        this.style.top = "-50px";
    }

</script>
</body>
</html>

相关文章

  • 隐藏盒子

  • 盒子文字溢出隐藏

    .css1{ color:#6699ff;border:1px #ff8000 dashed; margi...

  • 盒子css隐藏方法

    1.不占位置: a. display: none; b. height: 0; overflow: ...

  • 显示和隐藏盒子

  • 移动端轮播图

    核心原理CSS1、width:100%是指当前盒子占父盒子的100%;2、图片盒子一定要加溢出隐藏,overflo...

  • magnifying-glass 放大镜

    思路 1- 鼠标移入移出小图盒子 显示和隐藏 mask阴影层 和 大图盒子 2- 为小图盒子添加鼠标移动事件2-1...

  • 文本多行显示,超出规定行数后隐藏

    声明盒子类型 规定子元素排列方式 设置超出后隐藏 呈现

  • 秘密

    我有一个盒子 里面装着我曾经的秘密 我把盒子锁住 不告诉任何人 那些我的秘密 我把盒子放入了黑暗 它被隐藏 只有我...

  • 带tab栏上拉加载

    点击上面的盒子,对应显示下面的盒子,其他兄弟元素隐藏。这种写法比较适合类目少的情况使用。 类目多的话,建议下面用一...

  • 京东网站项目

    1)做小箭头的html 2)css的表示1,把i当做一个小的盒子当菱形超出盒子时隐藏超出部分(overflow)2...

网友评论

      本文标题:隐藏盒子

      本文链接:https://www.haomeiwen.com/subject/twtzyxtx.html