頁尾資訊
常見的頁尾資訊區塊。
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| <div class="main_footer"> <div class="wrap"> <div class="item"> <h4>金魚系列 VI - 頁尾資訊區域</h4> <ul> <li> <i class="fas fa-chevron-right"></i>flex-direction 的原理 </li> <li><i class="fas fa-chevron-right"></i>flex-grow</li> <li> <i class="fas fa-chevron-right"></i>Google font 使用 </li> <li> <i class="fas fa-chevron-right"></i>font-awesome </li> </ul> </div> <div class="item"> <h4>公司形象網站必切</h4> <ul> <li> <i class="fas fa-chevron-right"></i>不學起來不行 </li> <li><i class="fas fa-chevron-right"></i>太常用到了</li> <li> <i class="fas fa-chevron-right"></i>flex-grow 真好用 </li> <li> <i class="fas fa-chevron-right"></i >快趁機學起來當字典 </li> </ul> </div> <div class="item"> <h4>友站連結</h4> <ul> <li> <i class="fas fa-chevron-right"></i>異業結盟專區 </li> <li> <i class="fas fa-chevron-right"></i>異業都要結盟了 </li> <li> <i class="fas fa-chevron-right"></i>同業還不結盟 </li> <li><i class="fas fa-chevron-right"></i>團結力量大</li> </ul> </div> <div class="item"> <h4>訂閱電子報</h4> <form> <input type="text" placeholder="電子報還沒看" /> <button class="subsBtn">訂閱</button> </form> </div> </div> <div class="copyright"> <p> copyright © Follow CSScoke Goldfish series by Hsuchihting </p> </div> </div>
|
CSS
要跟其他頁面結合時,記得 position: fixed;
要拿掉。
使用 flex-grow
: 讓區塊等寬。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| .main_footer { background: linear-gradient(-20deg, #3f5494, #08c7a5); padding: 100px 0 0 0; position: fixed; bottom: 0; right: 0; left: 0; } .wrap { width: 1200px; margin: 0 auto; display: flex; }
.item { display: flex; flex-direction: column; //讓 item 區塊都一樣寬 flex-grow: 1; color: #fff; margin-right: 1%; margin-left: 1%; h4 { font-size: 24px; border-bottom: 1px dotted #fff; font-weight: 700; padding-bottom: 10px; } li { font-size: 16px; font-weight: 300; padding-top: 10px; line-height: 1.5; cursor: pointer; .fas { padding-right: 5px; transition: all 0.5s; } &:hover { color: #fbc02d; } }
form { // 垂直置中 display: flex; margin: auto 0; input { width: 80%; height: 30px; outline: none; border: 1px solid #cccccc; padding-left: 12px; } .subsBtn { width: 20%; background-color: #fbc02d; color: #fff; border: none; outline: none; cursor: pointer; &:hover { background-color: darken(#fbc02d, 15%); transition: all 0.5s; } } } }
.copyright { width: 100%; text-align: center; color: #ffffff; font-weight: 300; font-size: 16px; background-color: #0a254e; padding: 10px 0; margin-top: 150px; }
|
參考:
https://www.youtube.com/watch?v=Y02yl_QQNv0&t=2s
https://hsuchihting.github.io/css/20200718/3780287185/