Blogger Information
Blog 56
fans 1
comment 0
visits 62705
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
HTML元素的三大属性及样式规则
零龙
Original
1784 people have browsed it

HTML元素的三大属性


1. ID属性:由用户保证它的唯一性,专用于获取唯一元素。

2. Class属性:类属性返回共同特征的元素集合。

3. Style属性:设置当前元素对象的样式。


HTML元素属性的样式规则


  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>元素属性的样式规则</title>
  7. </head>
  8. <style>
  9. #title-id
  10. {
  11. color:violet;
  12. font-size:20px;
  13. }
  14. .title-Class
  15. {
  16. color:darkgreen;
  17. font-size:18px;
  18. }
  19. #title-h
  20. {
  21. font-weight: bold;
  22. }
  23. .title-h
  24. {
  25. color: darkgoldenrod;
  26. padding-left: 15px;
  27. }
  28. </style>
  29. <body>
  30. <p id="title-id">ID元素的样式,字体颜色violet,字体大小:20像素</p>
  31. <p class="title-Class">Class元素的样式,字体颜色darkgreen,字体大小:18像素</p>
  32. <p style="color: darkred; font-size: 16px;">Style元素的样式,字体颜色darkred,字体大小:16像素</p>
  33. <p id="title-h" class="title-h" style="background-color: black; height:50px; line-height:50px;">三个元素样式混搭,ID元素:粗体字,Class元素:颜色:darkgoldenrod,填充15个像素,Style元素:背景黑色,行高50像素,文本垂直居中</p>
  34. </body>
  35. </html>
Correcting teacher:WJWJ

Correction status:qualified

Teacher's comments:写的不错,继续加油。
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post