Blogger Information
Blog 11
fans 0
comment 0
visits 8654
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PC端、移动端布局方案
Haggi的糖果屋
Original
617 people have browsed it

一、PC端通用布局解决方案

代码

  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>PC端布局的通用解决方案</title>
  7. <style>
  8. /* 初始化 */
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. box-sizing: border-box;
  13. }
  14. a {
  15. color: #666;
  16. text-decoration: none;
  17. }
  18. /* 将body转为flex */
  19. body {
  20. min-width: 680px;
  21. display: flex;
  22. /* 主轴垂直方向,不换行 */
  23. flex-flow: column nowrap;
  24. background-color: lightgrey;
  25. background-image: url("4.jpg");
  26. background-repeat: no-repeat;
  27. background-size: cover;
  28. }
  29. header,
  30. footer {
  31. height: 50px;
  32. border: 1px solid #000;
  33. background-color: #111;
  34. }
  35. /* 将页眉转为flex */
  36. header {
  37. display: flex;
  38. /* 所有项目在交叉轴方向上居中显示 */
  39. align-items: center;
  40. }
  41. header > a {
  42. flex: 0 1 100px;
  43. text-align: center;
  44. color: whitesmoke;
  45. }
  46. header > a:nth-of-type(n + 2) {
  47. margin: auto;
  48. }
  49. /* Logo */
  50. header > a:first-of-type {
  51. margin-right: 50px;
  52. margin-left: 50px;
  53. font-style: italic;
  54. font-size: 20px;
  55. }
  56. header > a:last-of-type {
  57. margin-left: auto;
  58. margin-right: 0;
  59. }
  60. /* 鼠标悬停时忽略logo */
  61. header > a:hover:not(:first-of-type) {
  62. color: coral;
  63. font-size: 1.2rem;
  64. }
  65. .container {
  66. min-height: 580px;
  67. margin: 10px auto;
  68. display: flex;
  69. justify-content: center;
  70. }
  71. .container > aside,
  72. .container > main {
  73. border: 1px solid #000;
  74. padding: 10px;
  75. }
  76. .container > aside {
  77. flex: 0 0 200px;
  78. background-image: url("3.jpg");
  79. background-size: cover;
  80. background-position: -63px;
  81. filter: blur(-1px);
  82. color: black;
  83. }
  84. .container > .astwo {
  85. background-image: url("5.jpg");
  86. background-size: cover;
  87. }
  88. .container > aside > .left {
  89. width: 200px;
  90. height: 500px;
  91. display: flex;
  92. flex-flow: column wrap;
  93. justify-content: space-evenly;
  94. font-size: 30px;
  95. }
  96. .container > aside > .left > p {
  97. width: 200px;
  98. text-align: center;
  99. }
  100. .container > main {
  101. flex: 0 0 600px;
  102. margin: 0 10px;
  103. }
  104. .container > main > .main-center {
  105. width: 100%;
  106. height: 100%;
  107. display: flex;
  108. flex-flow: column nowrap;
  109. justify-content: center;
  110. }
  111. .container > main > .main-center > .main-center-word {
  112. width: 100%;
  113. font-weight: bold;
  114. letter-spacing: 0.5rem;
  115. text-indent: 2.5rem;
  116. line-height: 2rem;
  117. }
  118. .container > .astwo {
  119. writing-mode: vertical-lr;
  120. writing-mode: tb-lr;
  121. font-size: 16px;
  122. letter-spacing: 0.5rem;
  123. text-indent: 2.5rem;
  124. line-height: 2rem;
  125. vertical-align: center;
  126. }
  127. footer {
  128. display: flex;
  129. flex-flow: column nowrap;
  130. text-align: center;
  131. height: 100px;
  132. }
  133. footer > p {
  134. font-size: 25px;
  135. color: pink;
  136. line-height: 100px;
  137. }
  138. </style>
  139. </head>
  140. <body>
  141. <!-- 页眉 -->
  142. <header>
  143. <a href="">LOGO</a>
  144. <a href="">首页</a>
  145. <a href="">导航1</a>
  146. <a href="">导航2</a>
  147. <a href="">导航3</a>
  148. <a href="">登录</a>
  149. </header>
  150. <!-- 主体 -->
  151. <div class="container">
  152. <!-- 左边栏 -->
  153. <aside>
  154. <div class="left">
  155. <p class="pa">下沙篇</p>
  156. <p class="pa">王权篇</p>
  157. <p class="pa">月红篇</p>
  158. <p class="pa">千颜篇</p>
  159. </div>
  160. </aside>
  161. <!-- 主体内容区 -->
  162. <main>
  163. <div class="main-center">
  164. <div class="main-center-word">
  165. 漫画的创作灵感来源于中国古典神话。小新认为,
  166. 爱情是文艺创作的一个永恒主题。他把从角色中感受
  167. 到的情绪用自己的理解展现出来,再加上中国神话,
  168. 就创作出了《狐妖小红娘》这个“玄幻搞笑纯情虐恋”的故事。
  169. 2010年,庹小新以“雪花啊”的名字在有妖气原创漫画梦工厂
  170. 连载漫画《狐狸精调教手册》。2012年,被漫友旗下周刊热
  171. 门杂志《漫画SHOW》邀请连载,并更名《狐妖小红娘》,
  172. 故事基于《狐狸精调教手册》重新设计,但保留原来的人物
  173. (除了王富贵外,名字和造型略有改动)以及人物性格
  174. 、故事背景。画面全部重画。但其后遭遇杂志停刊。
  175. 2013年,《狐妖小红娘》登陆腾讯动漫频道, 成为平台主推连载作品。
  176. </div>
  177. </div>
  178. </main>
  179. <!-- 右边栏 -->
  180. <aside class="astwo">
  181. 根据古典小说记载,世上有人有妖,妖会与人相恋,
  182. 妖寿命千万年。人的寿命有限,人死了,妖活着。人会投胎转世,但投胎
  183. 以后,不记得上辈子的爱。妖如果痴情的话,就去找狐妖“购买”一项服务,
  184. 让投胎转世的人,回忆起前世的爱。
  185. </aside>
  186. </div>
  187. <!-- 页脚 -->
  188. <footer>
  189. <p>《狐妖小红娘》</p>
  190. </footer>
  191. </body>
  192. </html>

运行图:

Correcting teacher:GuanhuiGuanhui

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