亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

搜索
博主信息
博文 22
粉絲 1
評(píng)論 1
訪(fǎng)問(wèn)量 26596
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板
前端簡(jiǎn)單樣例(Grid初使用)-- PHP培訓(xùn)十期線(xiàn)上班
Miss灬懶蟲(chóng)
原創(chuàng)
901人瀏覽過(guò)

前端簡(jiǎn)單樣例(Grid初使用)— PHP培訓(xùn)十期線(xiàn)上班

說(shuō)明

  • 使用 css 的 display: grid;將元素設(shè)置為網(wǎng)格布局,注意設(shè)置以后 元素的部分css屬性會(huì)失效。
  • 使用 grid-template-columns 和 grid-template-rows 進(jìn)行網(wǎng)格區(qū)域劃分;

效果圖

網(wǎng)格劃分方案

代碼實(shí)現(xiàn)

  1. 項(xiàng)目目錄結(jié)構(gòu)

  1. HTML代碼
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>CMS系統(tǒng)首頁(yè)</title>
  6. <link rel="stylesheet" href="css/font/iconfont.css">
  7. <link rel="stylesheet" href="css/index.css">
  8. </head>
  9. <body>
  10. <div class="all">
  11. <!-- 頁(yè)面頂部部分-->
  12. <div class="page_top ">
  13. <!-- 頂部?jī)?nèi)容-->
  14. <div class="top logo">
  15. <img src="images/logo.png" alt="logo">
  16. </div>
  17. <!-- 頂部留白-->
  18. <div class="top blank"></div>
  19. <!-- 頂部搜索框-->
  20. <div class="top search">
  21. <span>
  22. <i class="iconfont">&#xe61f;</i>
  23. </span>
  24. </div>
  25. <!-- 頂部圖標(biāo)-->
  26. <div class="top ioc">
  27. <ul>
  28. <li><a href=""><span class="iconfont">&#xeb66;</span></a></li>
  29. <li><a href=""><span class="iconfont">&#xe61b;</span></a></li>
  30. <li><a href=""><span class="iconfont">&#xec0a;</span></a></li>
  31. <li><a href=""><span class="iconfont">&#xec14;</span></a></li>
  32. <li><a href=""><span class="iconfont">&#xe60e;</span></a></li>
  33. <li><a href=""><span class="iconfont">&#xec80;</span></a></li>
  34. <li class="clear"></li>
  35. </ul>
  36. </div>
  37. <!-- 頂部 nav導(dǎo)航欄-->
  38. <div class="nav a">
  39. <span class="iconfont span_one">&#xec39;</span>
  40. <table cellspacing="0">
  41. <tr>
  42. <td class="td_one"><a href="">資訊</a></td>
  43. <td><a href="">器材</a></td>
  44. <td><a href="">大師</a></td>
  45. <td><a href="">學(xué)院</a></td>
  46. <td><a href="">實(shí)戰(zhàn)</a></td>
  47. </tr>
  48. <tr>
  49. <td class="td_one" >資訊</td>
  50. <td>器材</td>
  51. <td>大師</td>
  52. <td>學(xué)院</td>
  53. <td>實(shí)戰(zhàn)</td>
  54. </tr>
  55. </table>
  56. <span class="clear"></span>
  57. </div>
  58. <div class="nav b">
  59. <span class="iconfont span_one">&#xec39;</span>
  60. <table cellspacing="0">
  61. <tr>
  62. <td class="td_one"><a href="">資訊</a></td>
  63. <td><a href="">器材</a></td>
  64. <td><a href="">大師</a></td>
  65. <td><a href="">學(xué)院</a></td>
  66. <td><a href="">實(shí)戰(zhàn)</a></td>
  67. </tr>
  68. <tr>
  69. <td class="td_one" >資訊</td>
  70. <td>器材</td>
  71. <td>大師</td>
  72. <td>學(xué)院</td>
  73. <td>實(shí)戰(zhàn)</td>
  74. </tr>
  75. </table>
  76. <span class="clear"></span>
  77. </div>
  78. <div class="nav c">
  79. <span class="iconfont span_one">&#xec39;</span>
  80. <table cellspacing="0">
  81. <tr>
  82. <td class="td_one"><a href="">資訊</a></td>
  83. <td><a href="">器材</a></td>
  84. <td><a href="">大師</a></td>
  85. <td><a href="">學(xué)院</a></td>
  86. <td><a href="">實(shí)戰(zhàn)</a></td>
  87. </tr>
  88. <tr>
  89. <td class="td_one" >資訊</td>
  90. <td>器材</td>
  91. <td>大師</td>
  92. <td>學(xué)院</td>
  93. <td>實(shí)戰(zhàn)</td>
  94. </tr>
  95. </table>
  96. <span class="clear"></span>
  97. </div>
  98. <div class="nav d">
  99. <span class="iconfont span_one">&#xec39;</span>
  100. <table cellspacing="0">
  101. <tr>
  102. <td class="td_one"><a href="">資訊</a></td>
  103. <td><a href="">器材</a></td>
  104. <td><a href="">大師</a></td>
  105. <td><a href="">學(xué)院</a></td>
  106. <td><a href="">實(shí)戰(zhàn)</a></td>
  107. </tr>
  108. <tr>
  109. <td class="td_one" >資訊</td>
  110. <td>器材</td>
  111. <td>大師</td>
  112. <td>學(xué)院</td>
  113. <td>實(shí)戰(zhàn)</td>
  114. </tr>
  115. </table>
  116. <span class="clear"></span>
  117. </div>
  118. <!-- 頂部 banner圖內(nèi)容-->
  119. <div class="banner lefts">
  120. <img src="images/2.jpg" alt="banner left">
  121. </div>
  122. <div class="banner rights">
  123. <img src="images/banner-right.jpg" alt="banner right">
  124. </div>
  125. </div>
  126. <!--頁(yè)面中部?jī)?nèi)容部分-->
  127. <div class="page_content">
  128. <p>content</p>
  129. </div>
  130. <!--頁(yè)面底部版權(quán)與連接部分-->
  131. <div class="page_footer">
  132. <p>footer</p>
  133. </div>
  134. <div class="clear"></div>
  135. </div>
  136. </body>
  137. </html>
  1. CSS代碼
  1. /*字體圖標(biāo)資源引入*/
  2. @font-face {
  3. font-family: 'iconfont';
  4. src: url('font/iconfont.eot');
  5. src: url('font/iconfont.eot?#iefix') format('embedded-opentype'),
  6. url('font/iconfont.woff2') format('woff2'),
  7. url('font/iconfont.woff') format('woff'),
  8. url('font/iconfont.ttf') format('truetype'),
  9. url('font/iconfont.svg#iconfont') format('svg');
  10. }
  11. .iconfont {
  12. font-family: "iconfont",serif !important;
  13. font-size: 16px;
  14. font-style: normal;
  15. -webkit-font-smoothing: antialiased;
  16. -moz-osx-font-smoothing: grayscale;
  17. }
  18. /*頁(yè)面通用樣式設(shè)置*/
  19. *{
  20. margin: 0;
  21. padding: 0;
  22. }
  23. body{ font-size: 13px;}
  24. ul{ display: inline-block;}
  25. ul li{
  26. float: left;
  27. list-style: none;
  28. }
  29. a{
  30. color: black;
  31. text-decoration: none;
  32. font-size: 13px;
  33. }
  34. table{
  35. width: 260px;
  36. height: 60px;
  37. margin: 45px 0 0 -20px;
  38. /* border: 1px solid lightcoral;*/
  39. float: left;
  40. }
  41. td{
  42. width: 40px;
  43. height: 30px;
  44. line-height: 30px;
  45. text-align: center;
  46. /* border: 1px solid red;*/
  47. }
  48. .all{
  49. width: 84%;
  50. height: 1200px;
  51. margin: 0 8% 0 8%;
  52. }
  53. /*頁(yè)面頭部樣式*/
  54. .page_top{
  55. width: 100%;
  56. height: 560px;
  57. /*將元素轉(zhuǎn)換為網(wǎng)格 grid*/
  58. display: grid;
  59. /*設(shè)置網(wǎng)格個(gè)寬度*/
  60. grid-template-columns: 60px 140px 160px 50px 340px 50px 350px 50px 50px 350px;
  61. /*設(shè)置網(wǎng)格的高度*/
  62. grid-template-rows: 80px 120px 360px;
  63. float: left;
  64. }
  65. /* 設(shè)置網(wǎng)格中各單元格的位置
  66. grid-column: 7 / 8; 合并 7-8列
  67. grid-row: 1/10; 合并1-10行
  68. */
  69. /*頂部logo所在行 網(wǎng)格區(qū)域設(shè)置 */
  70. .logo{ grid-column: 1 / 3;grid-row: 1 / 2;}
  71. .blank{ grid-column: 3 /6;grid-row: 1 / 2;}
  72. .search{ grid-column: 6/9; grid-row: 1/2;}
  73. .ioc{grid-column: 9/11; grid-row: 1/2;}
  74. /*頂部導(dǎo)航部分 網(wǎng)格區(qū)域設(shè)置*/
  75. .a{ grid-column: 1/4;grid-row: 2/3;}
  76. .b{ grid-column: 4/6;grid-row: 2/3;}
  77. .c{ grid-column: 6/9; grid-row: 2/3;}
  78. .d{ grid-column: 9/11; grid-row: 2/3;}
  79. /*頂部 banner圖部分 網(wǎng)格區(qū)域設(shè)置*/
  80. .lefts{ grid-column: 1/9; grid-row: 3/4;}
  81. .rights{ grid-column: 9/11; grid-row: 3/4;}
  82. /*search*/
  83. .search span{
  84. width: 280px;
  85. height: 40px;
  86. margin:20px 0 0 100px ;
  87. border: 1px solid gray;
  88. display: inline-block;
  89. vertical-align: middle;
  90. border-radius: 13px;
  91. }
  92. .search i{
  93. font-size: 25px;
  94. margin: 5px 0 0 240px;
  95. /*相對(duì)父元素定位*/
  96. position: absolute;
  97. }
  98. /*ioc*/
  99. .ioc ul {
  100. margin: 20px 0 0 0;
  101. }
  102. .ioc ul li a span {
  103. width: 54px;
  104. height: 40px;
  105. line-height: 40px;
  106. text-align: center;
  107. font-size: 30px;
  108. margin-left: 10px;
  109. display: inline-block;
  110. }
  111. /*導(dǎo)航圖標(biāo)*/
  112. .span_one{
  113. width:80px ;
  114. height: 70px;
  115. font-size: 45px;
  116. color: #ff2017;
  117. margin: 50px 0 0 20px;
  118. display: block;
  119. float: left;
  120. }
  121. /*導(dǎo)航首列邊框*/
  122. .td_one{
  123. border-right: 2px solid #cccccc;
  124. }
  125. /*頂部 banner圖樣式*/
  126. .lefts img{
  127. width: 1194px;
  128. height: 360px;
  129. }
  130. .rights img{
  131. width: 400px;
  132. height: 360px;
  133. }
  134. /*頁(yè)面中部?jī)?nèi)容樣式*/
  135. .page_content{
  136. width: 100%;
  137. height: 560px;
  138. background: cornflowerblue;
  139. float: left;
  140. }
  141. /*頁(yè)面底部樣式*/
  142. .page_footer{
  143. width: 100%;
  144. height: 80px;
  145. background: coral;
  146. float: left;
  147. }
  148. .clear{
  149. clear: both;
  150. }
批改老師:天蓬老師天蓬老師

批改狀態(tài):不合格

老師批語(yǔ):本次作業(yè) 再三強(qiáng)調(diào),使用傳統(tǒng)的float+position實(shí)現(xiàn), 不允許使用grid,flex
本博文版權(quán)歸博主所有,轉(zhuǎn)載請(qǐng)注明地址!如有侵權(quán)、違法,請(qǐng)聯(lián)系admin@php.cn舉報(bào)處理!
全部評(píng)論 文明上網(wǎng)理性發(fā)言,請(qǐng)遵守新聞評(píng)論服務(wù)協(xié)議
0條評(píng)論
作者最新博文
關(guān)于我們 免責(zé)申明 意見(jiàn)反饋 講師合作 廣告合作 最新更新
php中文網(wǎng):公益在線(xiàn)php培訓(xùn),幫助PHP學(xué)習(xí)者快速成長(zhǎng)!
關(guān)注服務(wù)號(hào) 技術(shù)交流群
PHP中文網(wǎng)訂閱號(hào)
每天精選資源文章推送
PHP中文網(wǎng)APP
隨時(shí)隨地碎片化學(xué)習(xí)
PHP中文網(wǎng)抖音號(hào)
發(fā)現(xiàn)有趣的

Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)

  • 登錄PHP中文網(wǎng),和優(yōu)秀的人一起學(xué)習(xí)!
    全站2000+教程免費(fèi)學(xué)