# 第六週 - 格線系統 * 記得錄影 * 公布全部完課率獎品 ## 截止繳交作業時間點 * 8/25 第八週上課結束 * 8/27(五) 彩蛋課程 下週才會公布 * 9/10(日) 繳交截止日 ## BS5 格線系統 ![](https://i.imgur.com/L5wt3ej.png) ## Mobile first 與 Desktop first 差別 * [desktop first](https://codepen.io/liao/pen/WNQJVqr?editors=1100) * [mobile first](https://codepen.io/liao/pen/jObxgeW?editors=1100) ## 格線系統 - 減輕 magic number 出現 * 格線系統關鍵字:column(欄)、gutter(間距) * [960 grid,以前解析度都是 1024](https://960.gs/demo.html) * [BS4 layoutit](https://www.layoutit.com/build) > 常見總欄數是 12 ## [BS5 格線系統](https://bootstrap5.hexschool.com/docs/5.0/layout/grid/)原理 * 排版三劍客: .container、.row、.col 1~12 * .container * .container 固定寬度 * .container-fluid 滿版 * .row * no-gutters:不需要 gutters * 名言 1:.col- 的外層只能是 .row * 名言 2:.row 裡面只能是 .col- * 名言 3:網頁內容與元件請放在 .col- 裡面 > 常見錯誤,在 .col 增加寬度 > 常見錯誤,在格線系統調整左右 margin 與 padding > 常見觀念:可以加上下 的 margin 與 padding > 常見觀念:最外層至少補一個 container > 常見觀念:整體格線邏輯是一致 ## 格線範例 1. 左三右九欄,裡面加上元件 2. ul ,裡面 li 佔 3 欄,`list-unstyled` 3. [鐵人邦](https://ithelp.ithome.com.tw/)滿版式設計搭配 BS5 格線 4. [六角](https://www.hexschool.com/)右上角選單,以上課程都包含 5 欄居中 5. [表尾區塊是否寫死](https://xd.adobe.com/view/057f9d4e-6781-43fe-9aea-9f73f67dd2fd-502c/screen/5c7451a8-36b4-4973-8658-ac17cc2a0f81/specs/) ## BS5 格線斷點設計 * [文件位置](https://bootstrap5.hexschool.com/docs/5.0/layout/grid/#grid-options) * [範例處](https://codepen.io/hexschool/pen/OJpXqVj?editors=1100) ![](https://i.imgur.com/DQVevsr.png) > 若想先做 PC 版,可用 md、lg 當起手式 ## 格線系統與元件整合 * [範例處](https://codepen.io/liao/pen/abvaXyy?editors=1100) * [洧杰老師批改 BS5 幕資網頁](https://hackmd.io/@YmcMgo-NSKOqgTGAjl_5tg/HkOeaJIcO/%2F10fOwZuYQ_uCyWlUNFuk_g) ## 網站範例 + 通用類別搭配 * [IT 邦幫忙](https://ithelp.ithome.com.tw/) - 手機版時隱藏右側內容 * [六角學院](https://www.hexschool.com/) - 判斷哪些地方有用到 .row 哪些地方沒有 * [甜點電商表尾](https://wcc723.github.io/F2E-PK/products.html) - 表尾設計 + row 裡面再加 .col * [Bootstrap Template](https://bootstrapmade.com/bootstrap-4-templates/) - 一次搞懂所有格線系統用法 ## 中場休息 ## BS5 SCSS 載入 ([架構圖講解](https://whimsical.com/bs5-A1pswT87rkXs7peANUBVp6)) 1. [SCSS default 觀念講解](https://codepen.io/hexschool/pen/oNWawom?editors=1100) 2. [六角 Vite 範例](https://github.com/hexschool/web-layout-training-vite/tree/main),[Google Drive 下載連結](https://drive.google.com/file/d/1DKYr95ocy_1VzpoFfVE8XP1rH8PHL5uk/view?usp=sharing) ![](https://i.imgur.com/PP1OBZu.png) ``` @import "../../node_modules/bootstrap/scss/functions"; @import './utils/variables'; @import './layout/header.scss'; @import './layout/footer.scss'; @import './pages/index.scss'; @import "../../node_modules/bootstrap"; ``` > 不要去修改 node_modules/bootstrap 裡面的 SCSS,因為別人接手你 code 時,會自行使用 npm install 安裝套件,此時裡面模組就都重新下載了 ### repo 有更動的地方 1. 多加入了一個 [bootstrap](https://github.com/hexschool/web-layout-training-vite/blob/feature/bootstrap5/package.json#L18) 模組 2. 多加入了一個 [bootstrap JS](https://github.com/hexschool/web-layout-training-vite/blob/feature/bootstrap5/main.js#L2),讓 dist 編譯出來的 js 可以載入 BS5 JS 套件 3. [index.html](https://github.com/hexschool/web-layout-training-vite/blob/feature/bootstrap5/pages/index.html) 加入了些 BS5 範例元件 4. [SCSS](https://github.com/hexschool/web-layout-training-vite/blob/feature/bootstrap5/assets/scss/all.scss) 範例有變更 ## 第六週主線任務 * <a href="https://rpg.hexschool.com/training/36/task?type=detail&id=351" target="_top">第六週 - 活動訂票網</a> 備註一:可觀看 [作業設計稿 - 線上預覽操作教學](https://hackmd.io/J7ajdobzTlyideAARTLz5Q?view) 備註二:線上網址圖片,這裡六角已經上傳到[圖片空間](https://github.com/hexschool/2022-web-layout-training),本次作業圖片都放在 **2023week6 資料夾**,網址如下,其他以此類推: * https://raw.githubusercontent.com/hexschool/2022-web-layout-training/main/2023week6/cate01.svg * https://raw.githubusercontent.com/hexschool/2022-web-layout-training/main/2023week6/cate02.svg >補充:[如果不知道怎麼找到圖片路徑請點我](https://i.imgur.com/O7nQcFm.gif)