博主信息
博文 5
粉丝 0
评论 0
访问量 3419
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
固定定位以及三行三列的定位布局
wan-PHP
原创
683人浏览过

1.在线QQ客服的固定定位

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=qq, initial-scale=1.0" />
  7. <title>qq</title>
  8. <style>
  9. .box {
  10. height: 15vh;
  11. width: 40vw;
  12. background-color: skyblue;
  13. position: absolute;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <div class="box">
  19. <img src="q.png" alt="qq" width="190" height="60" />
  20. </div>
  21. </body>
  22. </html>
  23. `

2.三行三列的定位布局

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=`, initial-scale=1.0" />
  7. <title>三行三列</title>
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. box-sizing: border-box;
  13. }
  14. html {
  15. font-size: 10px;
  16. }
  17. body {
  18. font-size: 1.6rem;
  19. }
  20. header,
  21. footer {
  22. height: 6rem;
  23. background-color: royalblue;
  24. text-align: center;
  25. }
  26. .container {
  27. margin: 0.1rem 0;
  28. background-color: olivedrab;
  29. min-height: calc(100vh - 12.2rem);
  30. position: relative;
  31. text-align: center;
  32. }
  33. .container aside {
  34. width: 20rem;
  35. min-height: inherit;
  36. position: absolute;
  37. background-color: orange;
  38. }
  39. .container aside:first-of-type {
  40. left: 0;
  41. top: 0;
  42. background-color: red;
  43. }
  44. .container aside:last-of-type {
  45. right: 0;
  46. top: 0;
  47. }
  48. .container main {
  49. position: absolute;
  50. left: 20.5rem;
  51. right: 20.5rem;
  52. min-height: inherit;
  53. }
  54. </style>
  55. </head>
  56. <body>
  57. <header>页眉</header>
  58. <div class="container">
  59. <aside>左侧</aside>
  60. <main>内容区</main>
  61. <aside>右侧</aside>
  62. </div>
  63. <footer>页脚</footer>
  64. </body>
  65. </html>

批改老师:PHPzPHPz

批改状态:合格

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学