Blogger Information
Blog 28
fans 0
comment 1
visits 21318
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
HTML 第一课 页面结构
南宫
Original
677 people have browsed it

html页面的文档结构

  1. !DOCTYPE html 申明是HTML5
  2. <html></html> 是根标签
  3. <head></head> 是头部标签
  4. <body></body> 是文档主体标签
  5. <meta charset="UTF-8" /> 设置文档字符集
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 设置视窗大小限制,device-width : 限制设备宽度,initial-scale=1.0 :不缩放
  7. <title></title> 文档标题标签
  8. <p></p> 段落标签
  9. <img/> 图片标签
  10. <br/> 换行标签

html的三大通用属性

  1. id 获取标签 一般唯一
  2. class 获取标签 可以获取一组标签
  3. 标签名获取标签 ,可以获取同一类型标签

属性添加优先级
标签名获取元素赋值 < class获取标签元素赋值 < id获取标签元素赋值 < 行内标签赋值


  1. <style>
  2. #title{
  3. id属性标签设置样式
  4. }
  5. .content{
  6. class属性标签设置样式
  7. }
  8. 标签名{
  9. 给同一类型标签设置样式
  10. }
  11. </style>

<script>中获取标签方式</script>

  1. //获取id为title标签
  2. let title = document.getElementById('title');
  3. //获取class值为content标签一组
  4. let content = document.getElementsByClassName("content");
  5. //获取所有p标签
  6. let ps = document.getElementsByTagName("p");
  7. //获取id值为title标签
  8. let title1 = document.querySelector("#title");
  9. //获取class值为content第一个符合要求标签
  10. let content1 = document.querySelector(".content");
  11. //获取class值为content所有标签
  12. let contents = document.querySelectorAll(".content");
Correcting teacher:WJWJ

Correction status:qualified

Teacher's comments:总体写的不错,建议文档结构可以用代码写出来以便于了解熟悉html的结构。
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