题解 | #HTML+CSS+JS综合之点击按钮隐藏元素#
HTML+CSS+JS综合之点击按钮隐藏元素
http://www.nowcoder.com/practice/9b0016737b3040aaa61316890f1ac3f8
{"css":".box {\n width: 100px;\n height: 100px;\n border: solid 1px black;\n position : relative;\n /*补全代码*/\n \n}\n.btn{\n width: 20px;\n height: 20px;\n background-color: red;\n position:absolute;\n top:-10px;\n right :-10px;\n text-align:center;\n line-height:20px;\n /*补全代码*/\n \n}","js":"var btn = document.querySelector('.btn');\nvar box = document.querySelector('.box');\nbtn.onclick = function(){\n // 补全代码\n box.style.display = 'none'\n}","html":"<div class='box'>\n\t<div class='btn'>X</div>\n</div>","libs":[]}