Blogger Information
Blog 5
fans 0
comment 0
visits 3339
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
链接和锚点
浮沉
Original
999 people have browsed it

链接和锚点

链接:a标签,通过href属性来控制要链接的地址,通过targetf属性控制链接页面打开的方式;
锚点:将a标签的href的属性值设置为:#跳转到的元素id值即可;

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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. <body style="display: grid">
  9. <!-- 链接 a标签 -->
  10. <a href="https://www.baidu.com" target="_self">在当前页面打开百度</a>
  11. <a href="https://www.baidu.com" target="_blank"> 在新的页面打开百度 </a>
  12. <a href="https://www.baidu.com" target="demo1">通过iframe内联打开百度</a>
  13. <iframe frameborder="0" name="demo1" width="500px" height="500px"></iframe>
  14. <!-- 锚点 -->
  15. <a href="#goplaceid" id="backplaceid"
  16. >从当前页面的某个地方跳到另外一个地方</a
  17. >
  18. <div id="goplaceid" style="margin-top: 800px">
  19. <a href="#backplaceid"
  20. >你跳的那个href对应我这边的id,跳过来吧;点我你就可以跳回去了</a
  21. >
  22. </div>
  23. <a href="#">herf给个#号我就能跳到最顶端</a>
  24. </body>
  25. </html>
Correcting teacher:天蓬老师天蓬老师

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