微信登录

选择器 - id、class、<标签>

作用:选择器

通过HTML标注:
id、class、<标签>
的选择来改变CSS样式

.html

  1. <div id="id1">id1</div>
  2. <div class="class1">class1</div>
  3. <h1>标签选择器h1</h1>
  4. <li>li标签<p>p标签</p>li标签</li>

.css

  1. #id1{
  2. width:200px;
  3. height: 100px;
  4. background:#ffff00;
  5. }
  6. .class1{
  7. width:200px;
  8. height: 100px;
  9. background:#0000ff;
  10. }
  11. h1{
  12. width:200px;
  13. height: 100px;
  14. background:#00ffff;
  15. }
  16. /*和*/
  17. #id1,.class1{
  18. color: red;
  19. }
  20. /*li的p*/
  21. li p{
  22. color:blueviolet;
  23. }
选择器 - id、class、&lt;标签&gt;