题解 | CSS选择器——标签、类、ID选择器

CSS选择器——标签、类、ID选择器

https://www.nowcoder.com/practice/f76f7b7cbc8a47188481b425380b0785

{"html":"<html>\n    <head>\n        <meta charset=utf-8>\n        <style type=\"text/css\">\n            /*补全代码*/\n            /*统一设置所有div标签的字体大小为20px*/\n            div{\n                font-size: 20px;\n            }\n\n            div:not(.green):not(#black){/*选中既不是绿色又不是黑色的div*/\n                color: rgb(255,0,0);/*红色*/\n            }\n            .green{/*通过类名匹配*/\n                color: rgb(0,128,0);/*绿色*/\n            }\n            #black{/*通过id匹配*/\n                color: rgb(0,0,0);/*黑色*/\n            }\n\n        </style>\n    </head>\n    <body>\n        <div>红色</div>\n        <div class='green'>绿色</div>\n        <div id='black'>黑色</div>\n    </body>\n</html>\n","css":"/* html, body {\\n\\twidth: 100%;\\n\\theight: 100%;\\n\\tmargin: 0;\\n\\tpadding: 0;\\n} */","js":"// 请在这里输入代码"}

全部评论

相关推荐

不知道怎么取名字_:28届都开始出来找机会了,看来哪里都卷
实习简历求拷打
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务