SlideShare uma empresa Scribd logo
1 de 54
Baixar para ler offline
consectetur adipisicing elit, sed do
eiusmod tempor incididunt
consectetur adipisicing elit,
sed do eiusmod tempor
incididunt dolor in
reprehenderit in voluptate
eiusmod
sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt
mollit anim id est laborum.
yourcompany
• 六⾓角學院講師

⾼高雄前端社群核⼼心成員
• 專長:
• CSS、Sass
• 視覺設計
• Personal Blog: http://wcc723.github.io/
• Facebook: https://fb.com/wccCasper
• 快速了解 Grid Layout
• 案例說明
• 他是⼀個新的 CSS 屬性,直到今年才有比較多的
瀏覽器⽀援。

Chrome 57, Firefox 52, Safari 10.1…
• CSS Grid Layout 可以處理⼆維排版 (欄與列)

Flex 僅能處理 欄或列
• CSS Grid 與 Flex 可以共⽤
yourcompany
• display
• grid-template
• grid-template-columns
• grid-template-rows
• grid-template-areas
• grid-gap
• grid-column-gap
• grid-row-gap
• justify-items (內部元件)
• align-items (內部元件)
• justify-content (整體元件)
• align-content (整體元件)
• grid-auto-columns
• grid-auto-rows
• grid-auto-flow
必要
排版屬性
欄欄列列間隔
對⿑齊屬性
簡易易⾃自動屬性
• grid-column
• grid-column-start
• grid-column-end
• grid-row
• grid-row-start
• grid-row-end
• grid-area
• justify-self
• align-self
欄欄位起迄
列列位起迄
Area 定義
對⿑齊屬性
.container {
}
50px 200px auto
100px
auto
… …
gap
display: grid;
grid-template-columns: 50px 200px auto 200px 50px;
grid-gap: 10px 15px;
grid-template-rows: 100px auto 100px ;
.container {
display: grid;
grid-template-columns: 50px 200px auto 200px 50px;
grid-template-rows: 100px auto 100px ;
grid-gap: 10px 15px;
}
50px 200px auto
1 2 3 4 5 6
1
2
3
4
100px
auto
… …
.item-xxx{
grid-column: start / end;
grid-row: start / end;
}
50px 200px auto
1 2 3 4 5 6
1
2
3
4
100px
auto
… …
grid-column: 1 / 3;
grid-row: 2 / 3;
grid-column: 1 / 3;
grid-row: 2 / 3;
.item-xxx{
grid-column: start / end;
grid-row: start / end;
}
50px 200px auto
1 2 3 4 5 6
1
2
3
4
100px
auto
… …
grid-column: 1 / 6;
grid-row: 1 / 2;
grid-column: 1 / 3;
grid-row: 2 / 3;
grid-column: 3 / 6;
grid-row: 3 / 4;
Navbar
Header
Content
Menu
Content
Header
Navbar
Menu
Navbar
Header
Content
Menu
300px auto
Content
Header
Navbar
Menu
1
2
3
4
1 2 3
5
範例 網⾴

https://codepen.io/Wcc723/full/EvWZgo/
auto50px 200px … …
auto50px 200px … …
justify-content (整體元件⽔平對齊)
auto50px 200px … …
justify-content: flex-end
auto50px 200px … …
justify-content: flex-start
auto50px 200px … …
justify-content: center
justify-content: space-between
auto50px 200px … …
auto
50px 200px … …
align-content: (整體元件垂直對齊)
align-content: flex-start;
auto
50px 200px … …
auto
50px 200px … …
• justify-items: center (內部元件⽔平位置)
• align-items: center (內部元件垂直位置)
auto
50px 200px … …
• justify-items: center (內部元件⽔平位置)
• align-items: center (內部元件垂直位置)
• justify-self: flex-end;
• align-self: flex-start;
外層 justify-content
外層 align-content
外層 justify-items
外層 align-items
內層 justify-self
內層 align-self
• 對齊排版
• http://wcc723.github.io/WorkShop-gh-pages/
cssGridDisplay/
略懂了
.container {
display: grid;
grid-template-columns: 

repeat(16, 45px);
grid-template-rows: 

repeat(16, 45px);
}
grid-column: 3 / 11;
grid-row: 3 / 11;
.container {
display: grid;
grid-template-columns: 

repeat(16, 45px);
grid-template-rows: 

repeat(16, 45px);
}
蒙德⾥安範例

https://goo.gl/erWkg6
貪食蛇例

http://wcc723.github.io/WorkShop-gh-pages/snakesnake/
.grid {
transform: skewY(-12deg);
}
參考說明

https://goo.gl/A7ufbs
Stripe 網⾴

https://stripe.com/connect
Grid Layout 平⾯風格網⾴

https://goo.gl/vkbNrZ
優點
• 可以做出類似平⾯設計風格的網⾴
• 排版模式又多了⼀種選擇
缺點
• ⽬前⽀援度還不⾜
• 很多坑⽤過才會體會
範例
• https://codepen.io/Kseso/pen/xqNdmO
• https://stripe.com/connect
• https://goo.gl/vkbNrZ
參考⽂件
• https://css-tricks.com/snippets/css/complete-guide-grid/
• https://developer.mozilla.org/en-US/docs/Web/CSS/
CSS_Grid_Layout
Q and A

Mais conteúdo relacionado

Mais procurados

AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜
AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜
AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜Ryoma Sin'ya
 
実践Djangoの読み方 - みんなのPython勉強会 #72
実践Djangoの読み方 - みんなのPython勉強会 #72実践Djangoの読み方 - みんなのPython勉強会 #72
実践Djangoの読み方 - みんなのPython勉強会 #72Masashi Shibata
 
Coding standards for java
Coding standards for javaCoding standards for java
Coding standards for javamaheshm1206
 
jooqってなんて読むの? から始めるO/RマッパーとSpringBootの世界
jooqってなんて読むの? から始めるO/RマッパーとSpringBootの世界jooqってなんて読むの? から始めるO/RマッパーとSpringBootの世界
jooqってなんて読むの? から始めるO/RマッパーとSpringBootの世界Y Watanabe
 
Outlook アドイン開発入門
Outlook アドイン開発入門Outlook アドイン開発入門
Outlook アドイン開発入門Hiroaki Oikawa
 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by MukeshMukesh Kumar
 
連哈秋都懂的Git教學
連哈秋都懂的Git教學連哈秋都懂的Git教學
連哈秋都懂的Git教學hydai
 
意外と苦労する、一部の画面のみ ランドスケープ表示を許容する方法 (potatotips 第17回)
意外と苦労する、一部の画面のみ ランドスケープ表示を許容する方法 (potatotips 第17回)意外と苦労する、一部の画面のみ ランドスケープ表示を許容する方法 (potatotips 第17回)
意外と苦労する、一部の画面のみ ランドスケープ表示を許容する方法 (potatotips 第17回)将之 小野
 
PHP AST 徹底解説
PHP AST 徹底解説PHP AST 徹底解説
PHP AST 徹底解説do_aki
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDBLinaro
 
De-mystifying contributing to PostgreSQL
De-mystifying contributing to PostgreSQLDe-mystifying contributing to PostgreSQL
De-mystifying contributing to PostgreSQLLætitia Avrot
 
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説Masatoshi Tada
 
Juceで作るオーディオアプリケーション
Juceで作るオーディオアプリケーションJuceで作るオーディオアプリケーション
Juceで作るオーディオアプリケーションKohsuke Yuasa
 
JavaScript Control Statements I
JavaScript Control Statements IJavaScript Control Statements I
JavaScript Control Statements IReem Alattas
 
svn 능력자를 위한 git 개념 가이드
svn 능력자를 위한 git 개념 가이드svn 능력자를 위한 git 개념 가이드
svn 능력자를 위한 git 개념 가이드Insub Lee
 
WebサービスStartUP向け AWSスケーラブルな構成例
WebサービスStartUP向け AWSスケーラブルな構成例WebサービスStartUP向け AWSスケーラブルな構成例
WebサービスStartUP向け AWSスケーラブルな構成例Amazon Web Services Japan
 

Mais procurados (20)

AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜
AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜
AVX2時代の正規表現マッチング 〜半群でぐんぐん!〜
 
実践Djangoの読み方 - みんなのPython勉強会 #72
実践Djangoの読み方 - みんなのPython勉強会 #72実践Djangoの読み方 - みんなのPython勉強会 #72
実践Djangoの読み方 - みんなのPython勉強会 #72
 
Coding standards for java
Coding standards for javaCoding standards for java
Coding standards for java
 
jooqってなんて読むの? から始めるO/RマッパーとSpringBootの世界
jooqってなんて読むの? から始めるO/RマッパーとSpringBootの世界jooqってなんて読むの? から始めるO/RマッパーとSpringBootの世界
jooqってなんて読むの? から始めるO/RマッパーとSpringBootの世界
 
Outlook アドイン開発入門
Outlook アドイン開発入門Outlook アドイン開発入門
Outlook アドイン開発入門
 
Basic html
Basic htmlBasic html
Basic html
 
DVCSとGitの基礎
DVCSとGitの基礎DVCSとGitの基礎
DVCSとGitの基礎
 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by Mukesh
 
連哈秋都懂的Git教學
連哈秋都懂的Git教學連哈秋都懂的Git教學
連哈秋都懂的Git教學
 
意外と苦労する、一部の画面のみ ランドスケープ表示を許容する方法 (potatotips 第17回)
意外と苦労する、一部の画面のみ ランドスケープ表示を許容する方法 (potatotips 第17回)意外と苦労する、一部の画面のみ ランドスケープ表示を許容する方法 (potatotips 第17回)
意外と苦労する、一部の画面のみ ランドスケープ表示を許容する方法 (potatotips 第17回)
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
CSS media types
CSS media typesCSS media types
CSS media types
 
PHP AST 徹底解説
PHP AST 徹底解説PHP AST 徹底解説
PHP AST 徹底解説
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDB
 
De-mystifying contributing to PostgreSQL
De-mystifying contributing to PostgreSQLDe-mystifying contributing to PostgreSQL
De-mystifying contributing to PostgreSQL
 
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
 
Juceで作るオーディオアプリケーション
Juceで作るオーディオアプリケーションJuceで作るオーディオアプリケーション
Juceで作るオーディオアプリケーション
 
JavaScript Control Statements I
JavaScript Control Statements IJavaScript Control Statements I
JavaScript Control Statements I
 
svn 능력자를 위한 git 개념 가이드
svn 능력자를 위한 git 개념 가이드svn 능력자를 위한 git 개념 가이드
svn 능력자를 위한 git 개념 가이드
 
WebサービスStartUP向け AWSスケーラブルな構成例
WebサービスStartUP向け AWSスケーラブルな構成例WebサービスStartUP向け AWSスケーラブルな構成例
WebサービスStartUP向け AWSスケーラブルな構成例
 

Mais de Chih-cheng Wang

六角學院 - 從社群到公司
六角學院 - 從社群到公司六角學院 - 從社群到公司
六角學院 - 從社群到公司Chih-cheng Wang
 
網址管理與 DNS 託管全攻略
網址管理與 DNS 託管全攻略網址管理與 DNS 託管全攻略
網址管理與 DNS 託管全攻略Chih-cheng Wang
 
高雄前端社群 Web 開發讀書會 - 網頁設計規劃
高雄前端社群 Web 開發讀書會 - 網頁設計規劃高雄前端社群 Web 開發讀書會 - 網頁設計規劃
高雄前端社群 Web 開發讀書會 - 網頁設計規劃Chih-cheng Wang
 
Bootstrap4 與他的好搭檔
Bootstrap4 與他的好搭檔Bootstrap4 與他的好搭檔
Bootstrap4 與他的好搭檔Chih-cheng Wang
 
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)Chih-cheng Wang
 
專業前端 都如何管理 CSS
專業前端 都如何管理 CSS專業前端 都如何管理 CSS
專業前端 都如何管理 CSSChih-cheng Wang
 
響應式網頁實作坊
響應式網頁實作坊響應式網頁實作坊
響應式網頁實作坊Chih-cheng Wang
 
建立 Sass 環境,透過 Node sass
建立 Sass 環境,透過 Node sass建立 Sass 環境,透過 Node sass
建立 Sass 環境,透過 Node sassChih-cheng Wang
 
CSS 讀書會 - 1 (Grid system)
CSS 讀書會 - 1 (Grid system)CSS 讀書會 - 1 (Grid system)
CSS 讀書會 - 1 (Grid system)Chih-cheng Wang
 
Slack 基本功能介紹
Slack 基本功能介紹Slack 基本功能介紹
Slack 基本功能介紹Chih-cheng Wang
 

Mais de Chih-cheng Wang (11)

六角學院 - 從社群到公司
六角學院 - 從社群到公司六角學院 - 從社群到公司
六角學院 - 從社群到公司
 
網址管理與 DNS 託管全攻略
網址管理與 DNS 託管全攻略網址管理與 DNS 託管全攻略
網址管理與 DNS 託管全攻略
 
高雄前端社群 Web 開發讀書會 - 網頁設計規劃
高雄前端社群 Web 開發讀書會 - 網頁設計規劃高雄前端社群 Web 開發讀書會 - 網頁設計規劃
高雄前端社群 Web 開發讀書會 - 網頁設計規劃
 
Bootstrap4 與他的好搭檔
Bootstrap4 與他的好搭檔Bootstrap4 與他的好搭檔
Bootstrap4 與他的好搭檔
 
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
Sass 基礎教學 - 高雄前端社群(CSS 讀書會)
 
專業前端 都如何管理 CSS
專業前端 都如何管理 CSS專業前端 都如何管理 CSS
專業前端 都如何管理 CSS
 
響應式網頁實作坊
響應式網頁實作坊響應式網頁實作坊
響應式網頁實作坊
 
建立 Sass 環境,透過 Node sass
建立 Sass 環境,透過 Node sass建立 Sass 環境,透過 Node sass
建立 Sass 環境,透過 Node sass
 
CSS 讀書會 - 1 (Grid system)
CSS 讀書會 - 1 (Grid system)CSS 讀書會 - 1 (Grid system)
CSS 讀書會 - 1 (Grid system)
 
Slack 基本功能介紹
Slack 基本功能介紹Slack 基本功能介紹
Slack 基本功能介紹
 
Google design
Google designGoogle design
Google design
 

[Modern Web] CSS3 Grid Layout