Blogger Information
Blog 5
fans 0
comment 0
visits 3291
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
html 内联标签iframe css 选择器优先级
浮沉
Original
554 people have browsed it

1、内联框架标签iframe

内联框架标签iframe通常会和a标签配合使用,iframe的name和a标签的target的值一致,点击a标签的链接,内容会在iframe中进行显示。

  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. <style>
  8. div {
  9. display: grid;
  10. }
  11. iframe {
  12. width: 30em;
  13. height: 16em;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <div>
  19. <a href="https://j.map.baidu.com/51/6FJJ" target="hefei">合肥市地图</a>
  20. <iframe srcdoc="合肥市" name="hefei"> </iframe>
  21. </div>
  22. <div>
  23. <a href="https://j.map.baidu.com/ac/zzJJ" target="hangzhou">杭州市地图</a>
  24. <iframe srcdoc="杭州市" name="hangzhou"> </iframe>
  25. </div>
  26. </body>
  27. </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. <link rel="stylesheet" href="../css/iframe.css" />
  8. </head>
  9. <body>
  10. <div class="header">网站管理后台</div>
  11. <div class="aside">
  12. <a href="https://www.baidu.com/" target="content">百度</a>
  13. <a href="https://www.alibabagroup.com/" target="content">阿里</a>
  14. <a href="https://www.tencent.com/zh-cn" target="content">腾讯</a>
  15. <a href="https://www.163.com/" target="content">网易</a>
  16. </div>
  17. <div class="main">
  18. <iframe srcdoc="互联网巨头" name="content"></iframe>
  19. </div>
  20. </body>
  21. </html>

2、布局元素

可以使用header、aside、main、 section、 footer等布局元素来构成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. <link rel="stylesheet" href="../css/layout.css" />
  8. </head>
  9. <body>
  10. <header><h1>&lt;header&gt;</h1></header>
  11. <div class="container">
  12. <aside><h1>&lt;aside&gt;</h1></aside>
  13. <main>
  14. <h1>&lt;main&gt;</h1>
  15. <div>
  16. <section>
  17. <h1>&lt;section&gt;</h1>
  18. </section>
  19. <section>
  20. <h1>&lt;section&gt;</h1>
  21. </section>
  22. </div>
  23. </main>
  24. </div>
  25. <footer><h1>&lt;footer&gt;</h1></footer>
  26. </body>
  27. </html>

3、CSS选择器优先级

CSS 选择器优先级:标签<class选择器<id选择器;注意:如果在属性后面使用 !important 会覆盖页面内任何位置定义的元素样式。

  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>css语法基础</title>
  7. <style>
  8. /* 1. 标签选择器 */
  9. h1 {
  10. color: green !important;
  11. }
  12. /* 2. class选择器 */
  13. .active {
  14. color: aqua;
  15. }
  16. /* 3.id选择器 id:浏览器并不检查它的唯一性,由程序员自己控制 */
  17. #first {
  18. color: blue;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <h1 class="active" id="first">Hello World</h1>
  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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!