博客列表 >Grid项目在网格单元和容器中对齐方式、快速仿php中文网首页

Grid项目在网格单元和容器中对齐方式、快速仿php中文网首页

吳
原创
2021年01月03日 17:46:42628浏览

1.项目在网格单元对齐方式

place-items设置容器中的所有项目在网格单元中的对齐方式
项目在网格单元中默认是拉伸的,只有项目在网格单元中存在剩余空间时,对齐才有必要且有意义

  • place-items: 垂直方向 水平方向;
  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <title>项目在网格单元中的对齐方式</title>
  6. <style>
  7. * {
  8. margin: 0;
  9. padding: 0;
  10. box-sizing: border-box;
  11. }
  12. .container {
  13. border: 1px solid red;
  14. padding: 0.5em;
  15. display: grid;
  16. grid-template-columns: repeat(3, 1fr);
  17. grid-template-rows: repeat(2, 5em);
  18. grid-auto-rows: 5em;
  19. gap: 0.5em;
  20. }
  21. .container>.item {
  22. background-color: lightyellow;
  23. border: 1px solid red;
  24. padding: 0.5em;
  25. }
  26. .container>.item {
  27. height: 2em;
  28. width: 5em;
  29. }
  30. .container {
  31. /* 垂直居上 水平居中 */
  32. place-items: start center;
  33. /* 垂直水平都居中 */
  34. place-items: center center;
  35. /* 当第二个值与第一个值一样时,可以省略第二个 */
  36. place-items: center;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <div class="container">
  42. <div class="item">test1</div>
  43. <div class="item">test2</div>
  44. <div class="item">test3</div>
  45. <div class="item">test4</div>
  46. <div class="item">test5</div>
  47. <div class="item">test6</div>
  48. <div class="item">test7</div>
  49. <div class="item">test8</div>
  50. <div class="item">test9</div>
  51. </div>
  52. </body>
  53. </html>
  • place-items: stretch; 拉伸:取消项目的固定尺寸才可以看到效果

  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. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. }
  13. .container {
  14. border: 1px solid red;
  15. padding: 0.5em;
  16. display: grid;
  17. grid-template-columns: repeat(3, 1fr);
  18. grid-template-rows: repeat(2, 5em);
  19. grid-auto-rows: 5em;
  20. gap: 0.5em;
  21. }
  22. .container>.item {
  23. background-color: lightyellow;
  24. border: 1px solid red;
  25. padding: 0.5em;
  26. }
  27. .container {
  28. place-items: stretch;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <div class="container">
  34. <div class="item">test1</div>
  35. <div class="item">test2</div>
  36. <div class="item">test3</div>
  37. <div class="item">test4</div>
  38. <div class="item">test5</div>
  39. <div class="item">test6</div>
  40. <div class="item">test7</div>
  41. <div class="item">test8</div>
  42. <div class="item">test9</div>
  43. </div>
  44. </body>
  45. </html>
  • place-self:;设置容器中的某一个项目在网格单元中的对齐方式

  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <title>项目在网格单元中的对齐方式</title>
  6. <style>
  7. * {
  8. margin: 0;
  9. padding: 0;
  10. box-sizing: border-box;
  11. }
  12. .container {
  13. border: 1px solid red;
  14. padding: 0.5em;
  15. display: grid;
  16. grid-template-columns: repeat(3, 1fr);
  17. grid-template-rows: repeat(2, 5em);
  18. grid-auto-rows: 5em;
  19. gap: 0.5em;
  20. }
  21. .container>.item {
  22. background-color: lightyellow;
  23. border: 1px solid red;
  24. padding: 0.5em;
  25. }
  26. .container>.item {
  27. height: 2em;
  28. width: 5em;
  29. }
  30. .container>.item:nth-of-type(5) {
  31. background-color: red;
  32. /* 居中对齐 */
  33. place-self: center center;
  34. /* 底部对齐 */
  35. place-self: end;
  36. }
  37. </style>
  38. </head>
  39. <body>
  40. <div class="container">
  41. <div class="item">test1</div>
  42. <div class="item">test2</div>
  43. <div class="item">test3</div>
  44. <div class="item">test4</div>
  45. <div class="item">test5</div>
  46. <div class="item">test6</div>
  47. <div class="item">test7</div>
  48. <div class="item">test8</div>
  49. <div class="item">test9</div>
  50. </div>
  51. </body>
  52. </html>

2. 项目在容器中的对齐方式

只有项目在容器中存在剩余空间时对齐才有必要且有意义

  • place-content: center;将所有项目作为一个整体在容器中对齐

  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <title>项目在容器中的对齐方式</title>
  6. <style>
  7. * {
  8. margin: 0;
  9. padding: 0;
  10. box-sizing: border-box;
  11. }
  12. .container {
  13. height: 25em;
  14. border: 1px solid red;
  15. padding: 0.5em;
  16. display: grid;
  17. grid-template-columns: repeat(3, 10em);
  18. grid-template-rows: repeat(2, 5em);
  19. grid-auto-rows: 5em;
  20. gap: 0.5em;
  21. place-content: start start;
  22. /* 顶部居中 */
  23. place-content: start center;
  24. /* 水平居中 */
  25. place-content: center center;
  26. place-content: center;
  27. }
  28. .container>.item {
  29. background-color: yellow;
  30. border: 2px solid black;
  31. padding: 0.5em;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <div class="container">
  37. <div class="item">test1</div>
  38. <div class="item">test2</div>
  39. <div class="item">test3</div>
  40. <div class="item">test4</div>
  41. <div class="item">test5</div>
  42. <div class="item">test6</div>
  43. <div class="item">test7</div>
  44. <div class="item">test8</div>
  45. <div class="item">test9</div>
  46. </div>
  47. </body>
  48. </html>
  • place-content: space-around space-evenly;将所有项目打散成独立个体在容器中设置对齐方式

  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. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. }
  13. .container {
  14. height: 25em;
  15. border: 1px solid red;
  16. padding: 0.5em;
  17. display: grid;
  18. /* 只有所有项目在容器中存在剩余控件时对齐才有必要且有意义 */
  19. grid-template-columns: repeat(3, 10em);
  20. grid-template-rows: repeat(2, 5em);
  21. grid-auto-rows: 5em;
  22. gap: 0.5em;
  23. /* 二端对齐 */
  24. place-content: space-between;
  25. place-content: space-around space-evenly;
  26. }
  27. .container>.item {
  28. background-color: yellow;
  29. border: 2px solid black;
  30. padding: 0.5em;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. <div class="container">
  36. <div class="item">test1</div>
  37. <div class="item">test2</div>
  38. <div class="item">test3</div>
  39. <div class="item">test4</div>
  40. <div class="item">test5</div>
  41. <div class="item">test6</div>
  42. <div class="item">test7</div>
  43. <div class="item">test8</div>
  44. <div class="item">test9</div>
  45. </div>
  46. </body>
  47. </html>

2.快速仿php.cn首页布局

  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>仿php中文网首页</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. font-size: 14px;
  13. }
  14. li {
  15. list-style: none;
  16. }
  17. a {
  18. color: #b9b9bb;
  19. text-decoration: none;
  20. }
  21. header {
  22. background-color: black;
  23. display: grid;
  24. grid-template-columns: 170px 1fr 170px;
  25. grid-template-rows: 58px;
  26. /* gap: 0.5em; */
  27. /* place-items: center; */
  28. }
  29. header .top-container {
  30. display: grid;
  31. grid-template-columns: repeat(8, 100px);
  32. /* gap: 1em; */
  33. place-items: center start;
  34. height: 58px;
  35. padding-left: 30px;
  36. }
  37. header .top-container li {
  38. height: 100%;
  39. width: 100%;
  40. display: grid;
  41. place-items: center;
  42. border-bottom: 5px solid black;
  43. }
  44. header .top-container li:hover {
  45. /* background-color: rgb(59, 58, 58); */
  46. border-bottom: 5px solid rgb(17, 192, 17);
  47. transition: .3s;
  48. /* 给li标签设置小手 */
  49. cursor: pointer;
  50. }
  51. header .top-container li:hover a {
  52. color: #fff;
  53. transition: .3s;
  54. }
  55. header .logo {
  56. display: grid;
  57. place-items: center;
  58. grid-template-rows: 58px;
  59. }
  60. header .login {
  61. display: grid;
  62. /* text-align: center; */
  63. grid-template-columns: 50px 50px;
  64. place-items: center;
  65. }
  66. main {
  67. display: grid;
  68. place-items: center;
  69. }
  70. /* 主体:菜单栏 */
  71. main .body-top {
  72. width: 1200px;
  73. height: 510px;
  74. display: grid;
  75. /* 距离顶部20px */
  76. margin-top: 20px;
  77. /* 设置边框圆角 */
  78. border-radius: 10px;
  79. /* 设置轨道列宽 */
  80. grid-template-columns: 218px 60px 331px 120px;
  81. /* 边框阴影 */
  82. box-shadow: 2px 2px 10px #999;
  83. margin-bottom: 20px;
  84. }
  85. /* 左侧菜单栏 */
  86. main .body-top .body-left {
  87. height: 510px;
  88. background-color: rgb(56, 51, 51);
  89. border-radius: 10px 0 0 10px;
  90. padding-top: 15px;
  91. }
  92. main .body-top .body-left li {
  93. display: grid;
  94. line-height: 50px;
  95. grid-template-columns: 1fr 35px;
  96. /* 调整内边距距离 */
  97. padding: 5px 10px 5px 20px;
  98. }
  99. main .body-top .body-left li:hover {
  100. background-color: rgb(78, 76, 76);
  101. transition: .2s;
  102. }
  103. main .body-top .body-left li a+span {
  104. color: rgb(148, 143, 143);
  105. }
  106. /* 主体:顶部菜单栏 */
  107. main .body-top .body-mian .nav-top {
  108. /* background-color: yellow; */
  109. display: grid;
  110. grid-template-columns: repeat(7, 100px) 40px;
  111. grid-template-rows: 60px;
  112. gap: 5px;
  113. }
  114. main .body-top .body-mian .nav-top li {
  115. line-height: 60px;
  116. text-align: center;
  117. }
  118. main .body-top,
  119. .body-mian .nav-top li a {
  120. color: black;
  121. }
  122. main .body-top .body-mian .nav-top li a:hover {
  123. color: #999;
  124. }
  125. main .body-top .body-mian .nav-top .red {
  126. background-color: orangered;
  127. padding: 0 2px 0 2px;
  128. color: white;
  129. border-radius: 3px;
  130. }
  131. main .body-top .body-mian .nav-top .blue {
  132. background-color: rgb(67, 99, 146);
  133. padding: 0 2px 0 2px;
  134. color: white;
  135. border-radius: 3px;
  136. }
  137. main .body-top .body-mian .nav-top .yellow {
  138. background-color: rgb(255, 196, 0);
  139. padding: 0 2px 0 2px;
  140. color: white;
  141. border-radius: 3px;
  142. }
  143. /* 搜索框 */
  144. main .body-top .body-mian .nav-top input {
  145. background-color: #f1f0f0;
  146. border: none;
  147. outline: none;
  148. width: 240px;
  149. height: 30px;
  150. padding-left: 10px;
  151. border-radius: 2px;
  152. }
  153. /* 轮播图 */
  154. main .body-top .body-mian .body-img img {
  155. width: 982px;
  156. }
  157. /* 课程推荐 */
  158. main .body-top .body-mian .body-hdp {
  159. display: grid;
  160. width: 982px;
  161. grid-template-columns: repeat(4, 1fr);
  162. place-items: center;
  163. grid-template-rows: 108px;
  164. gap: 5px;
  165. }
  166. main .body-top .body-mian .body-hdp img {
  167. border-radius: 5px;
  168. }
  169. /* 中部广告图 */
  170. main .ggt img {
  171. border-radius: 5px;
  172. }
  173. /* 入门精品课程 */
  174. main .jpkc {
  175. width: 1200px;
  176. height: 646px;
  177. padding: 15px;
  178. box-shadow: 2px 2px 10px #999;
  179. /* background-color: rgb(247, 242, 242); */
  180. margin: 30px auto;
  181. display: grid;
  182. grid-template-rows: 50px 1fr;
  183. gap: 20px;
  184. border-radius: 10px;
  185. }
  186. main .jpkc h2 {
  187. color: #444444;
  188. text-align: center;
  189. font-size: 16px;
  190. font-weight: bold margin-bottom: 30px;
  191. }
  192. main .jpkc h2 span {
  193. color: #23a7ff;
  194. font-weight: bold;
  195. }
  196. main .jpkc-list {
  197. display: grid;
  198. margin-top: 58px;
  199. grid-template-columns: repeat(5, 1fr);
  200. grid-template-rows: repeat(3, 1fr);
  201. gap: 15px;
  202. }
  203. main .jpkc-list>* {
  204. box-shadow: 2px 2px 10px 2px rgb(218, 214, 214);
  205. /* background-color: rgb(238, 238, 238); */
  206. border-radius: 10px;
  207. width: 218px;
  208. }
  209. main .jpkc-list li img {
  210. width: 218px;
  211. border-radius: 10px;
  212. }
  213. main .jpkc-list li img:hover {
  214. opacity: 0.7;
  215. transition: 0.2s;
  216. }
  217. main .jpkc-list>li:first-of-type {
  218. grid-area: span 2;
  219. height: 331px;
  220. }
  221. main .jpkc-list>li span {
  222. background-color: rgb(116, 116, 116);
  223. color: white;
  224. margin-right: 5px;
  225. font-size: 12px;
  226. padding: 1px;
  227. border-radius: 3px;
  228. }
  229. main .jpkc-list {
  230. position: absolute;
  231. }
  232. main .jpkc-list .last {
  233. position: relative;
  234. text-align: center;
  235. border-radius: 10px;
  236. padding-top: 5px;
  237. background-color: white;
  238. bottom: 20px;
  239. color: black;
  240. }
  241. main .jpkc-list .bf {
  242. margin-left: 20px;
  243. font-size: 10px;
  244. margin-bottom: 10px;
  245. color: #999;
  246. }
  247. /* 页脚样式 */
  248. footer {
  249. background-color: rgb(54, 53, 53);
  250. }
  251. footer .fo {
  252. width: 1200px;
  253. display: grid;
  254. place-content: start center;
  255. }
  256. footer .fo .fo-dh {
  257. display: grid;
  258. padding-top: 20px;
  259. padding-bottom: 20px;
  260. grid-template-columns: repeat(9, 1fr);
  261. gap: 5px;
  262. }
  263. footer .fo .fo-dh li a {
  264. font-size: 10px;
  265. color: #ffffffb6;
  266. }
  267. footer .sm {
  268. color: #999;
  269. font-size: 8px;
  270. padding-bottom: 20px;
  271. }
  272. footer .fo-fo {
  273. color: #999;
  274. }
  275. footer .fo-fo .hz {
  276. display: grid;
  277. grid-template-columns: repeat(4, 1fr);
  278. width: 300px;
  279. padding-top: 20px;
  280. padding-bottom: 20px;
  281. }
  282. footer .fo-fo img {
  283. width: 18px;
  284. height: 15px;
  285. }
  286. </style>
  287. </head>
  288. <body>
  289. <header>
  290. <div class="logo">
  291. <a href=""><img src="https://www.php.cn/static/images/logo.png" alt=""></a>
  292. </div>
  293. <div class="top-container">
  294. <li><a href="">首页</a></li>
  295. <li><a href="">视频教程</a></li>
  296. <li><a href="">入门教程</a></li>
  297. <li><a href="">社区问答</a></li>
  298. <li><a href="">技术文章</a></li>
  299. <li><a href="">资源下载</a></li>
  300. <li><a href="">工具下载</a></li>
  301. <li><a href="">PHP培训</a></li>
  302. </div>
  303. <div class="login">
  304. <a href="">登录</a>
  305. <a href="">注册</a>
  306. </div>
  307. </header>
  308. <main>
  309. <div class="body-top">
  310. <div class="body-left">
  311. <li><a href="">php开发</a><span>&gt;</span></li>
  312. <li><a href="">前端开发</a><span>&gt;</span></li>
  313. <li><a href="">服务端开发</a><span>&gt;</span></li>
  314. <li><a href="">移动开发</a><span>&gt;</span></li>
  315. <li><a href="">数据库</a><span>&gt;</span></li>
  316. <li><a href="">服务器运维&下载</a><span>&gt;</span></li>
  317. <li><a href="">在线工具箱</a><span>&gt;</span></li>
  318. <li><a href="">常用类库</a><span>&gt;</span></li>
  319. </div>
  320. <div class="body-mian">
  321. <div class="nav-top">
  322. <li><a href="">PHP头条</a><span class="red"></span></li>
  323. <li><a href="">独孤九贱</a></li>
  324. <li><a href="">学习路线</a><span class="blue"></span></li>
  325. <li><a href="">在线工具</a></li>
  326. <li><a href="">趣味课堂</a><span class="yellow"></span></li>
  327. <li><a href="">社区问答</a></li>
  328. <li><a href="">课程直播</a></li>
  329. <li><input type="text" name="searce" placeholder="请输入关键字"></li>
  330. </div>
  331. <div class="body-img"><img src="https://img.php.cn/upload/article/000/000/001/5fb478a8e82cb116.jpg"
  332. alt=""></div>
  333. <div class="body-hdp">
  334. <a href=""><img src="https://www.php.cn/static/images/index_yunv.jpg" alt=""></a>
  335. <a href=""><img src="https://www.php.cn/static/images/index_php_item2_.png?1" alt=""></a>
  336. <a href=""><img src="https://www.php.cn/static/images/index_php_item3.jpg?1" alt=""></a>
  337. <a href=""><img src="https://www.php.cn/static/images/index_php_new4.jpg?1" alt=""></a>
  338. </div>
  339. </div>
  340. </div>
  341. <div class="ggt">
  342. <a href=""><img src="https://img.php.cn/upload/article/000/000/001/5fb478ce65c09239.jpg" alt=""></a>
  343. </div>
  344. <div class="jpkc">
  345. <h2><span>&lt;/&gt;</span>PHP入门精品课程<span>&lt;/&gt;</span></h2>
  346. <ul class="jpkc-list">
  347. <li><a href=""><img src="https://www.php.cn/static/images/index_learn_first.jpg" alt=""></a></li>
  348. <li>
  349. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  350. <a href="">
  351. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  352. </a>
  353. <p class="bf"> 1W+次播放</p>
  354. </li>
  355. <li>
  356. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  357. <a href="">
  358. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  359. </a>
  360. <p class="bf"> 1W+次播放</p>
  361. </li>
  362. <li>
  363. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  364. <a href="">
  365. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  366. </a>
  367. <p class="bf"> 1W+次播放</p>
  368. </li>
  369. <li>
  370. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  371. <a href="">
  372. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  373. </a>
  374. <p class="bf"> 1W+次播放</p>
  375. </li>
  376. <li>
  377. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  378. <a href="">
  379. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  380. </a>
  381. <p class="bf"> 1W+次播放</p>
  382. </li>
  383. <li>
  384. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  385. <a href="">
  386. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  387. </a>
  388. <p class="bf"> 1W+次播放</p>
  389. </li>
  390. <li>
  391. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  392. <a href="">
  393. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  394. </a>
  395. <p class="bf"> 1W+次播放</p>
  396. </li>
  397. <li>
  398. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  399. <a href="">
  400. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  401. </a>
  402. <p class="bf"> 1W+次播放</p>
  403. </li>
  404. <li>
  405. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  406. <a href="">
  407. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  408. </a>
  409. <p class="bf"> 1W+次播放</p>
  410. </li>
  411. <li>
  412. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  413. <a href="">
  414. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  415. </a>
  416. <p class="bf"> 1W+次播放</p>
  417. </li>
  418. <li>
  419. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  420. <a href="">
  421. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  422. </a>
  423. <p class="bf"> 1W+次播放</p>
  424. </li>
  425. <li>
  426. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  427. <a href="">
  428. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  429. </a>
  430. <p class="bf"> 1W+次播放</p>
  431. </li>
  432. <li>
  433. <a href=""><img src="https://img.php.cn/upload/course/000/000/001/5b63c72c61569244.png" alt=""></a>
  434. <a href="">
  435. <p class="last"><span>初级</span>编程学习方法分享直播</p>
  436. </a>
  437. <p class="bf"> 1W+次播放</p>
  438. </li>
  439. </ul>
  440. </div>
  441. </main>
  442. <footer>
  443. <div class="fo">
  444. <div class="fo-dh">
  445. <li><a href="">网站首页</a></li>
  446. <li><a href="">PHP视频</a></li>
  447. <li><a href="">PHP实战</a></li>
  448. <li><a href="">PHP代码</a></li>
  449. <li><a href="">PHP手册</a></li>
  450. <li><a href="">词条</a></li>
  451. <li><a href="">手记</a></li>
  452. <li><a href="">编程词典</a></li>
  453. <li><a href="">PHP培训</a></li>
  454. </div>
  455. <div class="sm">
  456. <p>php中文网:公益在线php培训,帮助PHP学习者快速成长!</p>
  457. </div>
  458. <div class="fo-fo">
  459. <p>Copyright 2014-2020 https://www.php.cn/ All Rights Reserved | 苏州跃动光标网络科技有限公司 | 苏ICP备2020058653号-1
  460. <img src="https://www.php.cn/static/images/foot_line.gif" alt="">
  461. </p>
  462. <div class="hz">
  463. <li><a href="">关于我们</a></li>
  464. <li><a href="">免责声明</a></li>
  465. <li><a href="">赞助与捐赠</a></li>
  466. <li><a href="">广告合作</a></li>
  467. </div>
  468. </div>
  469. </div>
  470. </footer>
  471. </body>
  472. </html>

3.grid媒体查询与专业的媒体查询区别

grid媒体查询:根据grid容器的宽度,除以最小最大值之间的项目宽度,获得auto-fit的值,垂直方向绘制autofit个列宽的网格,水平方向也类似绘制,空轨折叠,不占据容器空间。

专业的媒体查询:不是依据某元素的父级容器宽度计算,以屏幕宽度查询。

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议