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

搜索
博主信息
博文 22
粉絲 1
評論 1
訪問量 26601
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板
使用flex布局完成分頁、二手商品、評論回復(fù)--PHP培訓(xùn)十期線上班
Miss灬懶蟲
原創(chuàng)
1082人瀏覽過

使用flex布局完成分頁、二手商品、評論回復(fù)(補12.26)

因為工作原因,沒有能及完成相關(guān)學(xué)習(xí)任務(wù),后面會盡快補上。
下面是使用flex布局,完成的三個簡單例子,分別依次按照分頁、二手商品、評論回復(fù)順序編寫,每個項目有又分為 效果圖、布局思路、HTML代碼和CSS代碼幾個部分。

簡單的分頁

效果圖

布局思路

首先,將包裹分頁的容器轉(zhuǎn)換為“彈性盒子”容器(container),然后讓整個盒子居中顯示,并且將盒子內(nèi)容的空間平局分配個盒子里面的項目(item),然后的a便簽中的文本進(jìn)行樣式調(diào)整,包括文本水平以及垂直居中,字體大小等,最后個鼠標(biāo)動作添加劃過特效(手型、陰影等)。

HTML代碼

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>公共翻頁標(biāo)簽</title>
  6. <link rel="stylesheet" href="public_paginate.css">
  7. </head>
  8. <body>
  9. <div class="public-paginate">
  10. <a href="">&lt;</a>
  11. <a href="">1</a>
  12. <a href="">2</a>
  13. <a href="">3</a>
  14. <a href="">4</a>
  15. <a href="">5</a>
  16. <a href="">6</a>
  17. <a href="">7</a>
  18. <a href="">8</a>
  19. <a href="">&gt;</a>
  20. </div>
  21. </body>
  22. </html>

CSS代碼

  1. /*引入公共初始化標(biāo)簽樣式文件*/
  2. @import "public_reset.css";
  3. .public-paginate{
  4. width: 1200px;
  5. height: 60px;
  6. display: flex;
  7. flex-flow: row nowrap;
  8. /*設(shè)置子元素在主軸上的對齊方式*/
  9. justify-content: center;
  10. /*設(shè)置子元素在交叉軸上的對齊方式*/
  11. align-items: center;
  12. }
  13. .public-paginate > a{
  14. width: 60px;
  15. height: 40px;
  16. line-height: 40px;
  17. text-align: center;
  18. font-size: 14px;
  19. margin: 0 5px;
  20. border-radius: 5px;
  21. background-color: #fff;
  22. }
  23. .public-paginate > a:hover{
  24. font-size: 1.2em;
  25. font-weight: bolder;
  26. color: #fff;
  27. background-color: #0086b3;
  28. /*陰影效果:
  29. box-shadow: h-shadow v-shadow blur spread color inset.
  30. h-shadow: 陰影的水平位置
  31. v-shadow:陰影的垂直位置
  32. blur:陰影的模糊半徑
  33. spread:陰影的半徑
  34. color:陰影的顏色
  35. inset:將外部陰影改成內(nèi)部陰影【outset反過來】
  36. */
  37. box-shadow: 0 0 5px #888888;
  38. }

二手商品

效果圖

布局思路

首先,有一個包裹最外面的大盒子BOX(container),在打盒子里面有3 行項目(item),其中 row-1 標(biāo)題1、row-2 標(biāo)題2+導(dǎo)航、row-3(BOX-2)。
row-3(BOX-2)西面,又包含3個盒子(BOX-3),其中一個是商品的圖片和價格等,另外一個是快速入口。同時因為商品圖片格式等是一致的所以就又是一個盒子(BOX-4),而快速入口下面的廣告部分和上面的方向不一致,所以單拿出來做一個盒子(BOX-4。

HTML代碼

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>公共二手商品頭部列表</title>
  6. <link rel="stylesheet" href="public_second_hand.css">
  7. </head>
  8. <body>
  9. <div class="public-second-hand">
  10. <!-- 頭部標(biāo)題1-->
  11. <div class="title1">
  12. <span>搶好貨</span>
  13. <span>0低價,便捷,安全,快速</span>
  14. </div>
  15. <!-- 頭部標(biāo)題2-->
  16. <div class="title2">
  17. <span>熱門分類</span>
  18. <a href="">美女寫真</a>
  19. <a href="">日本美女</a>
  20. <a href="">美國美女</a>
  21. <a href="">國內(nèi)美女</a>
  22. <a href="">AV美女</a>
  23. </div>
  24. <!-- 二手商品列表以及快速入口-->
  25. <div class="hand-content">
  26. <!-- 商品列表-->
  27. <div class="hand-list">
  28. <div class="list-goods">
  29. <img src="../../../1220/images/shop/shop1.jpg" alt="">
  30. <span>美女性感寫真海報墻藝術(shù)裝飾、畫貼--圖1</span>
  31. <div class="goods-price">
  32. <span>&yen;345</span>
  33. <span>美女</span>
  34. </div>
  35. </div>
  36. <div class="list-goods">
  37. <img src="../../../1220/images/shop/shop2.jpg" alt="">
  38. <span>美女性感寫真海報墻藝術(shù)裝飾、畫貼--圖1</span>
  39. <div class="goods-price">
  40. <span>&yen;345</span>
  41. <span>美女</span>
  42. </div>
  43. </div>
  44. <div class="list-goods">
  45. <img src="../../../1220/images/shop/shop3.jpg" alt="">
  46. <span>美女性感寫真海報墻藝術(shù)裝飾、畫貼--圖1</span>
  47. <div class="goods-price">
  48. <span>&yen;345</span>
  49. <span>美女</span>
  50. </div>
  51. </div>
  52. <div class="list-goods">
  53. <img src="../../../1220/images/shop/shop4.jpg" alt="">
  54. <span>美女性感寫真海報墻藝術(shù)裝飾、畫貼--圖1</span>
  55. <div class="goods-price">
  56. <span>&yen;345</span>
  57. <span>美女</span>
  58. </div>
  59. </div>
  60. <div class="list-goods">
  61. <img src="../../../1220/images/shop/shop5.jpg" alt="">
  62. <span>美女性感寫真海報墻藝術(shù)裝飾、畫貼--圖1</span>
  63. <div class="goods-price">
  64. <span>&yen;345</span>
  65. <span>美女</span>
  66. </div>
  67. </div>
  68. <div class="list-goods">
  69. <img src="../../../1220/images/shop/shop6.jpg" alt="">
  70. <span>美女性感寫真海報墻藝術(shù)裝飾、畫貼--圖1</span>
  71. <div class="goods-price">
  72. <span>&yen;345</span>
  73. <span>美女</span>
  74. </div>
  75. </div>
  76. <div class="list-goods">
  77. <img src="../../../1220/images/shop/shop7.jpg" alt="">
  78. <span>美女性感寫真海報墻藝術(shù)裝飾、畫貼--圖1</span>
  79. <div class="goods-price">
  80. <span>&yen;345</span>
  81. <span>美女</span>
  82. </div>
  83. </div>
  84. <div class="list-goods">
  85. <img src="../../../1220/images/shop/shop8.jpg" alt="">
  86. <span>美女性感寫真海報墻藝術(shù)裝飾、畫貼--圖1</span>
  87. <div class="goods-price">
  88. <span>&yen;345</span>
  89. <span>美女</span>
  90. </div>
  91. </div>
  92. </div>
  93. <!-- 快速入口-->
  94. <div class="quick">
  95. <div class="quick-entry">
  96. <a href=""><img src="../../../1220/images/ad/1.png" alt=""></a>
  97. <a href=""><img src="../../../1220/images/ad/2.png" alt=""></a>
  98. <a href=""><img src="../../../1220/images/ad/3.png" alt=""></a>
  99. <a href=""><img src="../../../1220/images/ad/4.png" alt=""></a>
  100. </div>
  101. <div class="quick-ad">
  102. <img src="../../../1220/images/ad/image.png" alt="">
  103. <img src="../../../1220/images/ad/ad2.jpg" alt="">
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </body>
  109. </html>

CSS代碼

  1. /*引入公共重置標(biāo)簽樣式文件*/
  2. @import "public_reset.css";
  3. /*外層div轉(zhuǎn)彈性盒子*/
  4. .public-second-hand{
  5. width: 1260px;
  6. height: 530px;
  7. background-color: #fff;
  8. border-radius: 5px;
  9. font-size: 13px;
  10. color: #555555;
  11. display: flex;
  12. margin: 0 auto;
  13. flex-flow: column nowrap;
  14. }
  15. .public-second-hand:hover{
  16. box-shadow: 0 0 5px #888888;
  17. }
  18. /*頭部標(biāo)題1 樣式*/
  19. .public-second-hand >.title1{
  20. height: 40px;
  21. line-height: 40px;
  22. text-align: left;
  23. }
  24. .public-second-hand >.title1 >span:first-of-type{
  25. color: #404040;
  26. font-size: 1.4rem;
  27. margin: 0 10px;
  28. }
  29. .public-second-hand >.title1 >span:last-of-type{
  30. color: red;
  31. padding-left: 16px;
  32. }
  33. /*頭部標(biāo)題2 以及分類導(dǎo)航樣式*/
  34. .public-second-hand >.title2{
  35. height: 40px;
  36. margin: 10px 10px;
  37. border-top: 1px solid #cccccc;
  38. }
  39. .public-second-hand >.title2 >span{
  40. color: red;
  41. font-size: 1.4rem;
  42. }
  43. .public-second-hand >.title2 >a{
  44. margin: 0 10px;
  45. }
  46. .public-second-hand >.title2> a:hover {
  47. color: lightcoral;
  48. cursor: pointer;
  49. }
  50. /*商品列表與快速入口的大盒子*/
  51. .public-second-hand >.hand-content{
  52. height: 420px;
  53. display: flex;
  54. margin: 0 5px;
  55. }
  56. /*商品列表小盒子*/
  57. .public-second-hand> .hand-content >.hand-list{
  58. width: 850px;
  59. height: 420px;
  60. display: flex;
  61. flex-flow: row wrap;
  62. }
  63. /*商品圖片與介紹*/
  64. .list-goods{
  65. width: 200px;
  66. height: 120px;
  67. display: flex;
  68. flex-flow: column nowrap;
  69. margin: 0 5px;
  70. }
  71. .list-goods > img{
  72. width: 190px;
  73. height: 120px;
  74. border-radius: 4px;
  75. }
  76. /*價格*/
  77. .goods-price{
  78. text-align: center;
  79. display: flex;
  80. }
  81. .goods-price >span:first-of-type{
  82. color: red;
  83. font-weight: bolder;
  84. }
  85. .goods-price >span:last-of-type{
  86. color: #fff;
  87. background-color: #669900;
  88. margin-left: auto;
  89. }
  90. /*快速入口小盒子*/
  91. .public-second-hand> .hand-content >.quick{
  92. width: 410px;
  93. height: 420px;
  94. display: flex;
  95. flex-flow: column wrap;
  96. }
  97. .quick-entry{
  98. display: flex;
  99. flex-flow: row wrap;
  100. justify-content: space-evenly;
  101. }
  102. .quick-entry a{
  103. margin-top: 5px;
  104. }
  105. .quick-entry a img{
  106. width: 190px;
  107. height: 120px;
  108. }
  109. .quick-ad{
  110. display: flex;
  111. flex-flow: column nowrap;
  112. margin: 0 auto;
  113. }
  114. .quick-ad >img{
  115. width: 380px;
  116. height: 65px;
  117. }

評論回復(fù)

效果圖

布局思路
首先,將模塊分成兩個部分,即評論區(qū)和回復(fù)區(qū)。因為都縱向排列,所以盒子基本都是flex-flow: column nowrap;,而評論區(qū)的文本域需要鋪滿剩余空間,所以flex:auto;resize: none;
其次,在回復(fù)內(nèi)容部分,因為回復(fù)點贊在另一個,所以最后這一樣也要轉(zhuǎn)化為盒子,并且包裹回復(fù)的<span>元素,需要margin-left: auto;

HTML代碼

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>公共組件-評論回復(fù)</title>
  6. <link rel="stylesheet" href="public_comments_reply.css">
  7. </head>
  8. <body>
  9. <div class="public-comments-reply">
  10. <!-- 評論區(qū)域-->
  11. <div class="comments">
  12. <span>我要評論</span>
  13. <div class="comments-content">
  14. <img src="../../../1220/images/user.png" alt="">
  15. <label for="comments_text"></label>
  16. <textarea name="comments_text" id="comments_text" cols="30" rows="10"></textarea>
  17. </div>
  18. <button>發(fā)表評論</button>
  19. </div>
  20. <!-- 回復(fù)區(qū)域-->
  21. <div class="reply">
  22. <span>最新回復(fù)</span>
  23. <!-- 評論回復(fù)列表-->
  24. <div class="reply-list">
  25. <img src="../../../1220/images/user.png" alt="">
  26. <!-- 評論內(nèi)容-->
  27. <div class="reply-content">
  28. <span>用戶昵稱</span>
  29. <span>留言內(nèi)容:PHP中文網(wǎng)是一個有溫度、有內(nèi)容、有理想的學(xué)習(xí)平臺!</span>
  30. <!-- 回復(fù)時間與點贊-->
  31. <div>
  32. <span>2019-12-23 14:52:49發(fā)布</span>
  33. <span><i class="iconfont">&#xec80;</i>回復(fù)</span>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="reply-list">
  38. <img src="../../../1220/images/user.png" alt="">
  39. <!-- 評論內(nèi)容-->
  40. <div class="reply-content">
  41. <span>用戶昵稱</span>
  42. <span>留言內(nèi)容:PHP中文網(wǎng)是一個有溫度、有內(nèi)容、有理想的學(xué)習(xí)平臺!</span>
  43. <!-- 回復(fù)時間與點贊-->
  44. <div>
  45. <span>2019-12-23 14:52:49發(fā)布</span>
  46. <span><i class="iconfont">&#xec80;</i>回復(fù)</span>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="reply-list">
  51. <img src="../../../1220/images/user.png" alt="">
  52. <!-- 評論內(nèi)容-->
  53. <div class="reply-content">
  54. <span>用戶昵稱</span>
  55. <span>留言內(nèi)容:PHP中文網(wǎng)是一個有溫度、有內(nèi)容、有理想的學(xué)習(xí)平臺!</span>
  56. <!-- 回復(fù)時間與點贊-->
  57. <div>
  58. <span>2019-12-23 14:52:49發(fā)布</span>
  59. <span><i class="iconfont">&#xec80;</i>回復(fù)</span>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="reply-list">
  64. <img src="../../../1220/images/user.png" alt="">
  65. <!-- 評論內(nèi)容-->
  66. <div class="reply-content">
  67. <span>用戶昵稱</span>
  68. <span>留言內(nèi)容:PHP中文網(wǎng)是一個有溫度、有內(nèi)容、有理想的學(xué)習(xí)平臺!</span>
  69. <!-- 回復(fù)時間與點贊-->
  70. <div>
  71. <span>2019-12-23 14:52:49發(fā)布</span>
  72. <span><i class="iconfont">&#xec80;</i>回復(fù)</span>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </body>
  79. </html>

CSS代碼

  1. /*引入公共重置標(biāo)簽樣式文件*/
  2. @import "public_reset.css";
  3. .public-comments-reply{
  4. width: 1200px;
  5. height: 720px;
  6. font-size: 13px;
  7. color: #555555;
  8. background-color: #fff;
  9. display: flex;
  10. flex-flow: column nowrap;
  11. margin: 0 auto;
  12. }
  13. .public-comments-reply img{
  14. width: 50px;
  15. height: 50px;
  16. border-radius: 2px;
  17. box-shadow: 0 0 2px #888888;
  18. margin: 0 14px;
  19. }
  20. /*評論區(qū)域樣式*/
  21. .public-comments-reply >.comments{
  22. width: 1160px;
  23. height: 320px;
  24. display: flex;
  25. flex-flow: column nowrap;
  26. justify-content: flex-start;
  27. border-top: 1px solid #cccccc;
  28. margin: 10px 10px;
  29. }
  30. /*評論區(qū)標(biāo)題*/
  31. .public-comments-reply >.comments >span:first-of-type{
  32. height: 60px;
  33. line-height: 60px;
  34. font-weight: bolder;
  35. }
  36. /*評論切頭像與評論內(nèi)容*/
  37. .comments >.comments-content{
  38. height: 200px;
  39. display: flex;
  40. }
  41. /*文本域樣式*/
  42. .comments >.comments-content >textarea{
  43. height: 200px;
  44. flex:auto;
  45. /*文本域不予許調(diào)整大小*/
  46. resize: none;
  47. }
  48. .comments >.comments-content >textarea:hover{
  49. box-shadow: 0 0 5px #888888;
  50. }
  51. /*評論區(qū)提交按鈕按*/
  52. .public-comments-reply >.comments >button{
  53. width: 130px;
  54. height: 34px;
  55. border: none;
  56. line-height: 34px;
  57. text-align: center;
  58. color: #fff;
  59. background-color: #ff2017;
  60. margin-top: 20px;
  61. margin-left: auto;
  62. }
  63. .public-comments-reply >.comments >button:hover {
  64. background-color: #178cee;
  65. cursor: pointer;
  66. box-shadow: 0 0 2px #888888;
  67. }
  68. /*回復(fù)區(qū)域樣式*/
  69. .public-comments-reply >.reply{
  70. width: 1160px;
  71. height: 360px;
  72. display: flex;
  73. flex-flow: column nowrap;
  74. margin:0 10px;
  75. }
  76. .public-comments-reply >.reply >span{
  77. height: 50px;
  78. line-height: 50px;
  79. font-weight: bolder;
  80. }
  81. /*回復(fù)內(nèi)容 頭像+內(nèi)容*/
  82. .public-comments-reply>.reply>.reply-list{
  83. height: 70px;
  84. display: flex;
  85. flex-flow: row nowrap;
  86. margin-bottom: 18px;
  87. }
  88. .public-comments-reply>.reply>.reply-list> img{
  89. /*子元素交叉軸居中*/
  90. align-self: center;
  91. }
  92. /*回復(fù)內(nèi)容*/
  93. .public-comments-reply>.reply>.reply-list>.reply-content{
  94. flex:auto;
  95. display: flex;
  96. flex-flow: column nowrap;
  97. justify-content: space-around;
  98. }
  99. .public-comments-reply>.reply>.reply-list>.reply-content >div{
  100. display: flex;
  101. }
  102. .public-comments-reply>.reply>.reply-list>.reply-content >div >span:last-of-type{
  103. margin-left: auto;
  104. }
  105. .public-comments-reply>.reply>.reply-list>.reply-content >div >span> i{
  106. color: #ff2017;
  107. font-size: 20px;
  108. margin-right: 10px;
  109. }

謝謝,閱讀瀏覽!

批改老師:天蓬老師天蓬老師

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

老師批語:對頁面的基本控制技術(shù), 是宏觀上知識 , 對于字體大小顏色等細(xì)節(jié), 還是要根據(jù)自己喜愛決定
本博文版權(quán)歸博主所有,轉(zhuǎn)載請注明地址!如有侵權(quán)、違法,請聯(lián)系admin@php.cn舉報處理!
全部評論 文明上網(wǎng)理性發(fā)言,請遵守新聞評論服務(wù)協(xié)議
0條評論
作者最新博文
關(guān)于我們 免責(zé)申明 意見反饋 講師合作 廣告合作 最新更新
php中文網(wǎng):公益在線php培訓(xùn),幫助PHP學(xué)習(xí)者快速成長!
關(guān)注服務(wù)號 技術(shù)交流群
PHP中文網(wǎng)訂閱號
每天精選資源文章推送
PHP中文網(wǎng)APP
隨時隨地碎片化學(xué)習(xí)
PHP中文網(wǎng)抖音號
發(fā)現(xiàn)有趣的

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

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