id是唯一的.前面的div可以不写,但写了也不会出错.有时为了代码的可读性还是建议写上
div#box {
color: red;
}
==>
满足这个选择器的元素:
1. DIV元素
2. ID为"box"
当然,如果还有一个选择器为 #box { color: blue; }
div#box { color: red; } 的权重(优先级)比 #box { color: blue; }
则最终 div 的内容颜色为 "red"
谢谢两位,明白了!
Copyright © 2019- hron.cn 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务