课程作业:

  1. 制作一个在线QQ客服的固定定位(QQ客服用图片就行);
  2. 仿课堂案例写一个三行三列的定位布局, 色块或边框代表内容就可以;
  3. 将之前落下的作业补齐;
  4. 在mdn上预习flex和js的知识,下周要学习.

作业内容:

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

知识点:

1、引用iconfont图标制作客服窗口

2、使用position:fixed;固定定位在线客服窗口位置在右边

实例代码:

  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=device-width, initial-scale=1.0" />
  7. <title>在线QQ客服固定定位</title>
  8. <link
  9. rel="stylesheet"
  10. href="//at.alicdn.com/t/font_2650193_58a6zhtdo67.css"
  11. />
  12. <style>
  13. html {
  14. background-color: bisque;
  15. min-height: 1500px;
  16. }
  17. .kefu {
  18. width: 7em;
  19. border: 1px solid;
  20. padding: 20px;
  21. margin: 20px;
  22. text-align: center;
  23. background-color: #3860f4;
  24. position: fixed;
  25. top: 30vh;
  26. right: 0;
  27. }
  28. .icon-kefu {
  29. color: #ffffff;
  30. font-size: 6em;
  31. }
  32. .kefu-01 {
  33. color: #ffffff;
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <h1>在线客服联系固定窗口</h1>
  39. <div class="kefu">
  40. <a class="kefu-01">在线客服联系</a>
  41. <br />
  42. <div class="kefu-img"><i class="iconfont icon-kefu"></i></div>
  43. <div class="kefu-lianxi">
  44. <button>点击我联系客服</button>
  45. </div>
  46. </div>
  47. </body>
  48. </html>

最终效果:

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=device-width, initial-scale=1.0" />
  7. <title>三行三列实例</title>
  8. <link
  9. rel="stylesheet"
  10. href="//at.alicdn.com/t/font_2650193_58a6zhtdo67.css"
  11. />
  12. <style>
  13. * {
  14. margin: 0;
  15. padding: 0;
  16. box-sizing: border-box;
  17. }
  18. /* body *:not(.container) {
  19. background-color: lightgreen;
  20. } */
  21. :root {
  22. font-size: 10px;
  23. }
  24. body {
  25. font-size: 1.6rem;
  26. }
  27. header,
  28. footer {
  29. height: 10rem;
  30. text-align: center;
  31. background-color: lightskyblue;
  32. min-width: inherit;
  33. }
  34. .container {
  35. margin: 0.5rem 0;
  36. position: relative;
  37. /* min-height: 600px; */
  38. min-height: calc(100vh - 21rem);
  39. }
  40. .container aside {
  41. width: 20rem;
  42. background-color: yellow;
  43. min-height: inherit;
  44. position: absolute;
  45. /* text-align: center; */
  46. /* 绝对定位必须要有一个定位父级元素(定位元素) */
  47. position: absolute;
  48. }
  49. /* 右侧定位 */
  50. .container aside:last-of-type {
  51. right: 0;
  52. top: 0;
  53. }
  54. .container main {
  55. position: absolute;
  56. left: 20.5rem;
  57. right: 20.5rem;
  58. background-color: lightcoral;
  59. min-height: inherit;
  60. }
  61. img {
  62. position: relative;
  63. width: 100%;
  64. height: 100%;
  65. }
  66. nav {
  67. display: inline;
  68. }
  69. footer div {
  70. line-height: 10rem;
  71. }
  72. .kefu {
  73. /* width: 9em; */
  74. border: 1px solid;
  75. padding: 5px;
  76. margin: 15px;
  77. text-align: center;
  78. background-color: #3860f4;
  79. }
  80. .icon-kefu {
  81. color: #ffffff;
  82. font-size: 6em;
  83. }
  84. .kefu-01 {
  85. color: #ffffff;
  86. }
  87. </style>
  88. </head>
  89. <body>
  90. <header>
  91. <img src="./img/banner.jpg" alt="" />
  92. </header>
  93. <div class="container">
  94. <aside>左边</aside>
  95. <main>中间</main>
  96. <aside>
  97. <div class="kefu">
  98. <a class="kefu-01">在线客服联系</a>
  99. <br />
  100. <div class="kefu-img"><i class="iconfont icon-kefu"></i></div>
  101. <div class="kefu-lianxi">
  102. <button>点击我联系客服</button>
  103. </div>
  104. </div>
  105. </aside>
  106. </div>
  107. <footer>
  108. <div>
  109. 友情链接:
  110. <nav class="nav-1"><a href="http://www.php.cn"></a></nav>
  111. <nav class="nav-2">
  112. <a href="http://www.haofanghui.net">好房会网站</a>
  113. </nav>
  114. </div>
  115. </footer>
  116. </body>
  117. </html>

最终效果:

更多相关文章

  1. 固定定位以及三行三列的定位布局
  2. 在线客服固定定位和三行三列布局
  3. 固定定位的联系客服+简易的三行三列布局
  4. 固定定位,三行三列定位布局
  5. html之常用布局实例
  6. 定位以及三行三列布局方式
  7. 固定定位及传统三行三列布局练习
  8. QQ在线客服,定位布局
  9. 在线QQ客服的固定定位以及三行三列的定位布局

随机推荐

  1. php类和对象的关系
  2. 深入理解PHP与WEB服务器交互
  3. php变量的作用域
  4. php语言的优势是什么
  5. 原生 PHP 实现支付宝 App 第三方登录获取
  6. php魔术常量使用方法
  7. php怎么远程连接oracle
  8. php八大数据类型有哪些
  9. php的优势与缺点
  10. php怎么接入公众号