Submit Search
Upload
CSS Layout
•
Download as PPTX, PDF
•
0 likes
•
680 views
景
景智 張
Follow
如何使用CSS做版面配置? 水平及垂直置中? 什麼是float? 什麼是clearfix? ;讓你更熟悉網頁排版
Read less
Read more
Education
Report
Share
Report
Share
1 of 21
Download now
Recommended
pasangh bendera di blog
pasangh bendera di blog
ellyndra
Presentation1
Presentation1
Victor Andreev
Hmmmm
Hmmmm
vian_89
Formatting Images with CSS in MadCap Flare - MadCap webinar, Scott DeLoach, C...
Formatting Images with CSS in MadCap Flare - MadCap webinar, Scott DeLoach, C...
Scott DeLoach
Wiidget
Wiidget
Nurul CUP
Player fixo
Player fixo
Pesinho
Ad
Ad
Rosi4
Fantastic Forty Share Point Templates
Fantastic Forty Share Point Templates
DU1NASA
Recommended
pasangh bendera di blog
pasangh bendera di blog
ellyndra
Presentation1
Presentation1
Victor Andreev
Hmmmm
Hmmmm
vian_89
Formatting Images with CSS in MadCap Flare - MadCap webinar, Scott DeLoach, C...
Formatting Images with CSS in MadCap Flare - MadCap webinar, Scott DeLoach, C...
Scott DeLoach
Wiidget
Wiidget
Nurul CUP
Player fixo
Player fixo
Pesinho
Ad
Ad
Rosi4
Fantastic Forty Share Point Templates
Fantastic Forty Share Point Templates
DU1NASA
Mobile Web Design Code
Mobile Web Design Code
Marko Dugonjić
Mmpng
Mmpng
Laurie Lyon, MSCS
Parceiros tkd
Parceiros tkd
thekingsofdrift
HTML5, the new buzzword
HTML5, the new buzzword
Frédéric Harper
бэм! в.харисов, с. бережной. зал 2
бэм! в.харисов, с. бережной. зал 2
rit2011
Calendar code
Calendar code
tba5050
Html frames
Html frames
ManishaSheelam
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Al-Mamun Sarkar
Private slideshow
Private slideshow
sblackman
LESS
LESS
Joe Seifi
02html Frames
02html Frames
Adil Jafri
Module 4 Minuteman Lexington Web Design Daniel Downs
Module 4 Minuteman Lexington Web Design Daniel Downs
Daniel Downs
Presentation1
Presentation1
shwetashinde58
Html basics 8 frame
Html basics 8 frame
H K
HTML&CSS 6 - Advanced CSS
HTML&CSS 6 - Advanced CSS
Dinis Correia
Css position
Css position
Webtech Learning
Css positioning
Css positioning
Gerson Abesamis
CSS Layouting #5 : Position
CSS Layouting #5 : Position
Sandhika Galih
CSS Positioning
CSS Positioning
Nguyễn Trịnh Hồng Ngọc
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
Stoyan Stefanov
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
Css Ppt
Css Ppt
Hema Prasanth
More Related Content
What's hot
Mobile Web Design Code
Mobile Web Design Code
Marko Dugonjić
Mmpng
Mmpng
Laurie Lyon, MSCS
Parceiros tkd
Parceiros tkd
thekingsofdrift
HTML5, the new buzzword
HTML5, the new buzzword
Frédéric Harper
бэм! в.харисов, с. бережной. зал 2
бэм! в.харисов, с. бережной. зал 2
rit2011
Calendar code
Calendar code
tba5050
Html frames
Html frames
ManishaSheelam
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Al-Mamun Sarkar
Private slideshow
Private slideshow
sblackman
LESS
LESS
Joe Seifi
02html Frames
02html Frames
Adil Jafri
Module 4 Minuteman Lexington Web Design Daniel Downs
Module 4 Minuteman Lexington Web Design Daniel Downs
Daniel Downs
Presentation1
Presentation1
shwetashinde58
Html basics 8 frame
Html basics 8 frame
H K
What's hot
(14)
Mobile Web Design Code
Mobile Web Design Code
Mmpng
Mmpng
Parceiros tkd
Parceiros tkd
HTML5, the new buzzword
HTML5, the new buzzword
бэм! в.харисов, с. бережной. зал 2
бэм! в.харисов, с. бережной. зал 2
Calendar code
Calendar code
Html frames
Html frames
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Private slideshow
Private slideshow
LESS
LESS
02html Frames
02html Frames
Module 4 Minuteman Lexington Web Design Daniel Downs
Module 4 Minuteman Lexington Web Design Daniel Downs
Presentation1
Presentation1
Html basics 8 frame
Html basics 8 frame
Viewers also liked
HTML&CSS 6 - Advanced CSS
HTML&CSS 6 - Advanced CSS
Dinis Correia
Css position
Css position
Webtech Learning
Css positioning
Css positioning
Gerson Abesamis
CSS Layouting #5 : Position
CSS Layouting #5 : Position
Sandhika Galih
CSS Positioning
CSS Positioning
Nguyễn Trịnh Hồng Ngọc
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
Stoyan Stefanov
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
Css Ppt
Css Ppt
Hema Prasanth
Viewers also liked
(8)
HTML&CSS 6 - Advanced CSS
HTML&CSS 6 - Advanced CSS
Css position
Css position
Css positioning
Css positioning
CSS Layouting #5 : Position
CSS Layouting #5 : Position
CSS Positioning
CSS Positioning
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Css Ppt
Css Ppt
Similar to CSS Layout
CSS3 Takes on the World
CSS3 Takes on the World
Jonathan Snook
CSS in React
CSS in React
Joe Seifi
Evrone.ru / BEM for RoR
Evrone.ru / BEM for RoR
Dmitry KODer
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
Rachel Andrew
Bem methodology
Bem methodology
Andrew Rota
Flash Camp - Degrafa & FXG
Flash Camp - Degrafa & FXG
jmwhittaker
SMACSS Workshop
SMACSS Workshop
Tim Hettler
"Вклад Adobe в Web". Дмитрий Барановский, Adobe
"Вклад Adobe в Web". Дмитрий Барановский, Adobe
Yandex
Componentization css angular
Componentization css angular
David Amend
I Can't Believe It's Not Flash
I Can't Believe It's Not Flash
Thomas Fuchs
Css web side
Css web side
Bahria University Islamabad, Pakistan
STC Summit 2015 Hypergraphics for visual-first help
STC Summit 2015 Hypergraphics for visual-first help
Dave Gardiner
The Creative New World of CSS
The Creative New World of CSS
Rachel Andrew
LessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG Meeting
Myles Braithwaite
CSS- Smacss Design Rule
CSS- Smacss Design Rule
皮馬 頑
Worth the hype - styled components
Worth the hype - styled components
kathrinholzmann
Confoo: You can use CSS for that!
Confoo: You can use CSS for that!
Rachel Andrew
Drawing a Circle Three Ways: Generating Graphics for the Web
Drawing a Circle Three Ways: Generating Graphics for the Web
Cloudinary
Next-level CSS
Next-level CSS
Rachel Andrew
BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014
vzaccaria
Similar to CSS Layout
(20)
CSS3 Takes on the World
CSS3 Takes on the World
CSS in React
CSS in React
Evrone.ru / BEM for RoR
Evrone.ru / BEM for RoR
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
Bem methodology
Bem methodology
Flash Camp - Degrafa & FXG
Flash Camp - Degrafa & FXG
SMACSS Workshop
SMACSS Workshop
"Вклад Adobe в Web". Дмитрий Барановский, Adobe
"Вклад Adobe в Web". Дмитрий Барановский, Adobe
Componentization css angular
Componentization css angular
I Can't Believe It's Not Flash
I Can't Believe It's Not Flash
Css web side
Css web side
STC Summit 2015 Hypergraphics for visual-first help
STC Summit 2015 Hypergraphics for visual-first help
The Creative New World of CSS
The Creative New World of CSS
LessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG Meeting
CSS- Smacss Design Rule
CSS- Smacss Design Rule
Worth the hype - styled components
Worth the hype - styled components
Confoo: You can use CSS for that!
Confoo: You can use CSS for that!
Drawing a Circle Three Ways: Generating Graphics for the Web
Drawing a Circle Three Ways: Generating Graphics for the Web
Next-level CSS
Next-level CSS
BEM Methodology — @Frontenders Ticino —17/09/2014
BEM Methodology — @Frontenders Ticino —17/09/2014
Recently uploaded
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
sanyamsingh5019
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Celine George
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Sarwono Sutikno, Dr.Eng.,CISA,CISSP,CISM,CSX-F
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
iammrhaywood
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
UnboundStockton
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
KarinaGenton
mini mental status format.docx
mini mental status format.docx
PoojaSen20
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
pboyjonauth
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
EduSkills OECD
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
Sayali Powar
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
Steve Thomason
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
dawncurless
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
anshu789521
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
SafetyChain Software
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology ( Production , Purification , and Application )
Sakshi Ghasle
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
VS Mahajan Coaching Centre
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
David Douglas School District
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
Celine George
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
JhengPantaleon
Recently uploaded
(20)
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
mini mental status format.docx
mini mental status format.docx
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology ( Production , Purification , and Application )
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
CSS Layout
1.
CSS Layout http://zh-tw.learnlayout.com/ 5/20 meeting
2.
3.
版面配置常用的CSS.... Display margin
Box Model Position float clear clearfix z-index column
4.
Display <span id="red">inline</span> <span id="blue">inline</span> <button
id="black">inline-block</button> <div id="green">block</div> https://developer.mozilla.org/en-US/docs/Web/CSS/display inline inline inline-block block inline-block inline-block visibility:hidden;display:none; https://jsfiddle.net/bc5b9nbo/ display:none; VS visibility:hidden;
5.
margin 水平置中 .div1 { background-color:#F00; width: 300px; height:
300px; text-align:center; } .div2 { width: 150px; height: 150px; background-color:#0F0; margin:0 auto; } http://jsfiddle.net/camel2243/gja77g9o/1/ <div class="div1"> <span>TEST</span> <div class="div2"></div> </div> div1div2 TEST
6.
那垂直置中呢..? margin:auto auto; margin-top:-50%; vertical-align:middle;
7.
垂直置中 <div id=“content”> 一行文字 </div> #content { font-size:32px; text-align:center; height:150px; line-height:150px; background-color:#F00; } 一行文字 http://jsfiddle.net/camel2243/vn3m0tx1/
8.
垂直置中 <div id="div1"> <div id="div2"> SSSS……….. </div> </div> #div1
{ display:table; word-break:break-all; } #div2 { max-width: 150px; height: 150px;; background-color:#0F0; display: table-cell; vertical-align: middle; } SSSSSSSSSSS SSSSSS...... http://jsfiddle.net/camel2243/r55L7L34/1/
9.
Box Model http://jsfiddle.net/camel2243/zkcnoofn/ <div class="simple"> 我小</div> <div
class="fancy"> 我大</div> .simple { width: 500px; margin: 20px auto; background-color:#F00; } .fancy { width: 500px; margin: 20px auto; padding: 50px; background-color:#0F0; } 我小 我大 box-sizing: border-box; 我小 我大
10.
Position static:預設位置。 relative:與
static 相同,可加額外屬性定位。 fixed:以瀏覽器視窗定位。 absolute: 定位在上層容器的相對位置。 http://jsfiddle.net/camel2243/za4f2jww/ <div class="container"> <nav><ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul></nav> <section>content1</section> <section>content2</section> <section>content3</section> </div> relative • 1 • 2 • 3 • 4 content1absolute content2 content3 static
11.
垂直置中 <div id="center"> TEST </div> #center { position:absolute; height:300px; top:50%; margin-top:-200px; background-color:#F00; } http://jsfiddle.net/camel2243/b1msc4hk/ TEST
12.
垂直置中 <div id="middle"> TEST </div> #middle { position:absolute; width:50%; height:280px; top:0; bottom:0; left:0; right:0; margin:auto; background-color:#0F0; overflow:auto; } http://jsfiddle.net/camel2243/j0n1gm5e/ SSSSSSSSSSSS SSSSS......
13.
float http://jsfiddle.net/camel2243/cdk54cv6/ div{ background-color:#CCC; } img { float: right; margin:
0 0 10px 10px; } <div> <img src=img.jpg" /> textKKKK.. </div> XXXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX img li li li …… inline-block ? block+float ?
14.
clear http://jsfiddle.net/camel2243/yz8bbdfr/ .box { float: left; width:
200px; height: 100px; margin: 10px; background-color:#F00; } section{ background-color:#0F0; } <div class="box">...</div> <section>TEXT</section>TEXT… TEXT … clear:both;
15.
clearfix XXXXXXXX img <div> <img src=img.jpg" /> textKKKK.. </div> div{ background-color:#CCC; } img
{ float: right; margin: 0 0 10px 10px; } li li li …… nav Solution? http://jsfiddle.net/camel2243/dhec9kvy/
16.
z-index http://jsfiddle.net/camel2243/v56ypdqc/ <div id=“red"> z-index:3; </div> <div id=“yellow"> z-index:2; </div> <div
id=“green"> z-index:1; </div> 記得要設position
17.
column <div class="three-column"> TEXT…… </div> .three-column { padding:
10px; column-count: 3; column-gap: 10px; background-color:#F00; } TEXT… ……… ……… ……… ……… ……… TEXT… ……… ……… ……… ……… ……… TEXT… ……… ……… ……… ……… ……… http://jsfiddle.net/camel2243/gy32w9cf/ flexbox ?
18.
總結 萬丈高樓平地起
19.
Reference 版面配置教學 http://zh-tw.learnlayout.com/ display、visibility、opacity 差異
http://stackoverflow.com/questions/272360/does-opacity0-have- exactly-the-same-effect-as-visibilityhidden/273076#273076 display 有哪些 https://developer.mozilla.org/en-US/docs/Web/CSS/display block 不該放在inline中 http://stackoverflow.com/questions/6061869/are-block-level- elements-allowed-inside-inline-level-elements-in-html5 垂直置中 http://blog.yam.com/hanasan/article/35806444
20.
Reference clearfix http://stackoverflow.com/questions/211383/which- method-of-clearfix-is-best z-index 其實很複雜
http://www.icoding.co/2013/06/knowledge-about-z- index-2
Editor's Notes
版面、移動位置
inline: <span>、<a>、<i>、<b> 行內元素,沒有margin-top、padding-top、width inline-block: <button>、<img>、<input>、<select> 保有行內元素、又有block性質,可設置所有屬性 block: <div>、<p> 寬度佔滿、換行
margin auto=0 margin use width base block no vertical-align
IE7 以下不支援 display: table;
fixed 在部分手機 browser 會有問題 上層容器不包括position:static;
calc
position:relative+float 先浮動後定位 position:absolute+float 不會浮動 Float element 要先寫
Jquery ui、bootstrap 都提供 clearfix 這個class
Download now