Blogger Information
Blog 5
fans 0
comment 0
visits 2266
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0702固定定位
AlUN
Original
427 people have browsed it

0702作业

制作一个在线QQ客服的固定定位

  1. <style>
  2. * {
  3. padding: 0;
  4. margin: 0;
  5. box-sizing: border-box;
  6. }
  7. .image {
  8. width: 5em;
  9. }
  10. .kefu {
  11. position: relative;
  12. height: 900em;
  13. }
  14. .image {
  15. position:fixed;
  16. top: 20em;
  17. bottom: 0;
  18. right: 0;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <div class="kefu">
  24. <img src="https://img0.baidu.com/it/u=3464795985,1960072882&fm=26&fmt=auto" alt="" class="image">
  25. </div>
  26. </body>

三行三列的定位布局

  1. <style>
  2. * {
  3. padding: 0;
  4. margin: 0;
  5. box-sizing: border-box;
  6. }
  7. body *:not(.container) {
  8. background-color: lightgreen;
  9. }
  10. :root {
  11. /* rem布局 */
  12. font-size: 10px;
  13. }
  14. body {
  15. font-size: 1.6rem;
  16. }
  17. header ,
  18. footer {
  19. height: 5rem;
  20. /* background-color: lightblue; */
  21. }
  22. .container {
  23. margin: 0.5rem 0;
  24. min-height: calc(100vh - 11rem);
  25. position: relative;
  26. }
  27. .container aside {
  28. width: 20rem;
  29. min-height: inherit;
  30. position: absolute;
  31. }
  32. .container aside:first-of-type {
  33. left: 0;
  34. top: 0;
  35. }
  36. .container aside:last-of-type {
  37. right: 0;
  38. top: 0;
  39. }
  40. .container main{
  41. position:absolute;
  42. left: 20.5rem;
  43. right: 20.5rem;
  44. /* background-color: lightgreen; */
  45. min-height: inherit;
  46. }
  47. </style>
  48. </head>
  49. <body>
  50. <header>页眉</header>
  51. <div class="container">
  52. <aside>左侧</aside>
  53. <main>内容区</main>
  54. <aside>右侧</aside>
  55. </div>
  56. <footer>页脚</footer>
  57. </body>
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