際際滷

際際滷Share a Scribd company logo
CSS
Layout
Display property
 Block
 Inline
 Inline-Block
Combined style  like inline element, but we can set width, height.
 Others (list-item, table,inline-table,table-row,table-cell, none)
Display property
 block
Has width( or take all parent width), height (or stretch by
content), always start at new line.
 Inline
Go one by one, width always stretch by content, height = line-
height property
Display property
 Inline-block
Has width(or stretch by content), height (or height = line-height
property), go one by one.
BOX Model
Box-sizing
 content-box
(Default value) width, height  for content only.
 Padding-box
Width, height including padding
 Border-box
Width, height including padding and border
Margin
margin: 20px;
margin: 5px 10px 15px 20px;
margin: 5px 10px 15px;
margin: 10px auto;
Collapsing vertical
margin
Relative Margins / Paddings
.parent
{
border: 1px solid red;
width: 300px;
}
.child
{
margin:20%;
border: 1px solid green;
}
All margins will be 60px = 20% from parents width
Float
http://jsfiddle.net/ywRW6/5/
<div class="block">
Hello CODE!
<div class="float">
float element
</div>
Can you see this?
It's floated!
</div>
.float {
float: left;
background: #CCC;
width: 200px; height: 200px;
margin-right: 25px;
padding: 10px;
}
img {float: right;}
Float
.clearfix {clear: both;}
.clearfix { overflow: auto; }
Position
 static (default)
 relative
.box2 {
position: relative;
top: -5px;
left: 10px;
}
 fixed
.fixed {
position: fixed;
bottom: 0; right: 0;
width: 200px;
}
Position
 Absolute
.relative {
position: relative;
width: 600px;
height: 400px;
}
.absolute {
position: absolute;
top: 120px;
right: 0;
width: 300px;
height: 200px;
}
Overflow
 visible
 hidden
 scroll
 auto
 text-overflow: ellipsis;
Z-index
<div class="block one">
Parent 5
<div class="block two">
Child 500
</div>
</div>
<div class="block three">
Absolute 10
</div>
Stacking Context:
1)position != static ; z-index != auto
2)opacity <1
3)transform or perspective (CSS3)
Negative Z-index
.parent
{
position: relative;
}
.child
{
position: absolute;
z-index: -1;
}
Table
table { display: table }
caption { display: table-caption }
thead { display: table-header-group }
tbody { display: table-row-group }
tfoot { display: table-footer-group }
tr { display: table-row }
td, th { display: table-cell }
<style>
.header {height:60px; background-color:#717dc9; padding:20px; text-align:center}
.left_col {width:120px; height:460px; background-color:#dddddd; padding:15px; vertical-align:top}
.center_col {background-color:#ffffff; padding:15px; vertical-align:top}
.right_col {width:120px; background-color:#dddddd; padding:15px; vertical-align:top}
.footer {padding:10px 0 10px 20px; background-color:#717dc9; font-size:13px}
</style>
<table cellpadding="0" cellspacing="0" width="100%" align="center">
<tr><td colspan="3" class="header">My site</td></tr>
<tr><td class="left_col">Left Menu</td><td class="center_col">Content streched to screen width</td>
<td class="right_col">Right block</td></tr>
<tr><td colspan="3" class="footer">&copy; All rights reserved</td></tr>
</table>
Table
HomeTask

More Related Content

What's hot (20)

Css box-model
Css box-modelCss box-model
Css box-model
Webtech Learning
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
M Ashraful Islam Jewel
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
jeweltutin
CSS tutorial chapter 2
CSS tutorial chapter 2CSS tutorial chapter 2
CSS tutorial chapter 2
jeweltutin
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
Hawkman Academy
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
Randy Oest II
Css training
Css trainingCss training
Css training
Leigh Aucoin
CSS Box Model and Dimensions
CSS Box Model and DimensionsCSS Box Model and Dimensions
CSS Box Model and Dimensions
Gerson Abesamis
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS Properties
Nosheen Qamar
Ppt ch06
Ppt ch06Ppt ch06
Ppt ch06
1geassking
Css
CssCss
Css
Nasla C.K
CSS Box Model Presentation
CSS Box Model PresentationCSS Box Model Presentation
CSS Box Model Presentation
Reed Crouch
Css
CssCss
Css
shinyduela
Lesson 02
Lesson 02Lesson 02
Lesson 02
Gene Babon
css v1 guru
css v1 gurucss v1 guru
css v1 guru
GuruPada Das
Understanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaUnderstanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company india
Jignesh Aakoliya
Website with HTML CSS
Website with HTML CSSWebsite with HTML CSS
Website with HTML CSS
Things Lab
CSS Cascade Style Sheet
CSS Cascade Style SheetCSS Cascade Style Sheet
CSS Cascade Style Sheet
Adeel Rasheed
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
Gheyath M. Othman
CSS tutorial chapter 3
CSS tutorial chapter 3CSS tutorial chapter 3
CSS tutorial chapter 3
jeweltutin
CSS tutorial chapter 2
CSS tutorial chapter 2CSS tutorial chapter 2
CSS tutorial chapter 2
jeweltutin
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
CSS Box Model and Dimensions
CSS Box Model and DimensionsCSS Box Model and Dimensions
CSS Box Model and Dimensions
Gerson Abesamis
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS Properties
Nosheen Qamar
CSS Box Model Presentation
CSS Box Model PresentationCSS Box Model Presentation
CSS Box Model Presentation
Reed Crouch
Understanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaUnderstanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company india
Jignesh Aakoliya
Website with HTML CSS
Website with HTML CSSWebsite with HTML CSS
Website with HTML CSS
Things Lab
CSS Cascade Style Sheet
CSS Cascade Style SheetCSS Cascade Style Sheet
CSS Cascade Style Sheet
Adeel Rasheed
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
Gheyath M. Othman

Similar to Css2layout (20)

Web Layout
Web LayoutWeb Layout
Web Layout
Shawn Calvert
CSS Position and its values
CSS Position and its valuesCSS Position and its values
CSS Position and its values
Gunjan Tulsiani
CSS3 Refresher
CSS3 RefresherCSS3 Refresher
CSS3 Refresher
Ivano Malavolta
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
Robyn Overstreet
Web Development - Lecture 6
Web Development - Lecture 6Web Development - Lecture 6
Web Development - Lecture 6
Syed Shahzaib Sohail
Lecture5.ppt C style sheet notes for B.CA and BIT
Lecture5.ppt C style sheet notes for B.CA and BITLecture5.ppt C style sheet notes for B.CA and BIT
Lecture5.ppt C style sheet notes for B.CA and BIT
RameshPrasadBhatta2
CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3
Jaimin Brahmbhatt
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Amit Tyagi
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 Workshop
Shoshi Roberts
animation for designing elements and botto
animation for designing elements and bottoanimation for designing elements and botto
animation for designing elements and botto
zahidyousuf9
UI 101
UI 101UI 101
UI 101
Rubikal
HTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherHTML5 and CSS3 Refresher
HTML5 and CSS3 Refresher
Ivano Malavolta
Web Design Course: CSS lecture 5
Web Design Course: CSS  lecture 5Web Design Course: CSS  lecture 5
Web Design Course: CSS lecture 5
Gheyath M. Othman
CSS3 TTA (Transform Transition Animation)
CSS3 TTA (Transform Transition Animation)CSS3 TTA (Transform Transition Animation)
CSS3 TTA (Transform Transition Animation)
谿曙
Css & css3
Css & css3Css & css3
Css & css3
isha
Lecture-8.pptx
Lecture-8.pptxLecture-8.pptx
Lecture-8.pptx
vishal choudhary
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvvLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
ZahouAmel1
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
Senthil Kumar
Unit - 3 CSS(Cascading Style Sheet).pptx
Unit - 3 CSS(Cascading Style Sheet).pptxUnit - 3 CSS(Cascading Style Sheet).pptx
Unit - 3 CSS(Cascading Style Sheet).pptx
kushwahanitesh592
SVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for BeginnersSVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for Beginners
Oswald Campesato
CSS Position and its values
CSS Position and its valuesCSS Position and its values
CSS Position and its values
Gunjan Tulsiani
Lecture5.ppt C style sheet notes for B.CA and BIT
Lecture5.ppt C style sheet notes for B.CA and BITLecture5.ppt C style sheet notes for B.CA and BIT
Lecture5.ppt C style sheet notes for B.CA and BIT
RameshPrasadBhatta2
CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3
Jaimin Brahmbhatt
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Amit Tyagi
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 Workshop
Shoshi Roberts
animation for designing elements and botto
animation for designing elements and bottoanimation for designing elements and botto
animation for designing elements and botto
zahidyousuf9
UI 101
UI 101UI 101
UI 101
Rubikal
HTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherHTML5 and CSS3 Refresher
HTML5 and CSS3 Refresher
Ivano Malavolta
Web Design Course: CSS lecture 5
Web Design Course: CSS  lecture 5Web Design Course: CSS  lecture 5
Web Design Course: CSS lecture 5
Gheyath M. Othman
CSS3 TTA (Transform Transition Animation)
CSS3 TTA (Transform Transition Animation)CSS3 TTA (Transform Transition Animation)
CSS3 TTA (Transform Transition Animation)
谿曙
Css & css3
Css & css3Css & css3
Css & css3
isha
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvvLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
ZahouAmel1
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
Senthil Kumar
Unit - 3 CSS(Cascading Style Sheet).pptx
Unit - 3 CSS(Cascading Style Sheet).pptxUnit - 3 CSS(Cascading Style Sheet).pptx
Unit - 3 CSS(Cascading Style Sheet).pptx
kushwahanitesh592
SVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for BeginnersSVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for Beginners
Oswald Campesato

More from Vadim Spiridenko (6)

Css5 canvas
Css5 canvasCss5 canvas
Css5 canvas
Vadim Spiridenko
Css6 svg
Css6 svgCss6 svg
Css6 svg
Vadim Spiridenko
Css3animation
Css3animationCss3animation
Css3animation
Vadim Spiridenko
Css1
Css1Css1
Css1
Vadim Spiridenko
Css1
Css1Css1
Css1
Vadim Spiridenko

Recently uploaded (14)

3d animation3d animation3d animation3d animation
3d animation3d animation3d animation3d animation3d animation3d animation3d animation3d animation
3d animation3d animation3d animation3d animation
animationkeemo21
JACKPOT TANGKI4D BERMAIN MENGGUNAKAN ID PRO 2025 TEPERCAYA LISENSI STAR GAMIN...
JACKPOT TANGKI4D BERMAIN MENGGUNAKAN ID PRO 2025 TEPERCAYA LISENSI STAR GAMIN...JACKPOT TANGKI4D BERMAIN MENGGUNAKAN ID PRO 2025 TEPERCAYA LISENSI STAR GAMIN...
JACKPOT TANGKI4D BERMAIN MENGGUNAKAN ID PRO 2025 TEPERCAYA LISENSI STAR GAMIN...
TANGKI4D
cyber hacking and cyber fraud by internet online money
cyber hacking and cyber fraud by internet online moneycyber hacking and cyber fraud by internet online money
cyber hacking and cyber fraud by internet online money
VEENAKSHI PATHAK
RIRs and the Next Chapter of Internet Growth - from IPv4 to IPv6
RIRs and the Next Chapter of Internet Growth - from IPv4 to IPv6RIRs and the Next Chapter of Internet Growth - from IPv4 to IPv6
RIRs and the Next Chapter of Internet Growth - from IPv4 to IPv6
APNIC
10 Critical Skills Kids Need in the AI Era
10 Critical Skills Kids Need in the AI Era10 Critical Skills Kids Need in the AI Era
10 Critical Skills Kids Need in the AI Era
RachelDines1
Here are the Top 10 Writers Of 2025 by GLCP
Here are the Top 10 Writers Of 2025 by GLCPHere are the Top 10 Writers Of 2025 by GLCP
Here are the Top 10 Writers Of 2025 by GLCP
glcppro
Building a Multiplatform SDKMAN in JavaFX.pdf
Building a Multiplatform SDKMAN in JavaFX.pdfBuilding a Multiplatform SDKMAN in JavaFX.pdf
Building a Multiplatform SDKMAN in JavaFX.pdf
Jago de Vreede
Shopify API Integration for Custom Analytics_ Advanced Metrics & Reporting Gu...
Shopify API Integration for Custom Analytics_ Advanced Metrics & Reporting Gu...Shopify API Integration for Custom Analytics_ Advanced Metrics & Reporting Gu...
Shopify API Integration for Custom Analytics_ Advanced Metrics & Reporting Gu...
CartCoders
QasyndaAIFinalVersionPresentationStartup
QasyndaAIFinalVersionPresentationStartupQasyndaAIFinalVersionPresentationStartup
QasyndaAIFinalVersionPresentationStartup
AidarIsakhanov
What Is the Difference Between the Internet and WAN.pdf
What Is the Difference Between the Internet and WAN.pdfWhat Is the Difference Between the Internet and WAN.pdf
What Is the Difference Between the Internet and WAN.pdf
Internet Bundle Now
phase_4_presentation[1] - Read-Only.pptx Iot
phase_4_presentation[1]  -  Read-Only.pptx Iotphase_4_presentation[1]  -  Read-Only.pptx Iot
phase_4_presentation[1] - Read-Only.pptx Iot
harshithamandya49
Hygiene-and-Sanitation with healthcare and the most important hygiene to be
Hygiene-and-Sanitation with healthcare and the most important hygiene to beHygiene-and-Sanitation with healthcare and the most important hygiene to be
Hygiene-and-Sanitation with healthcare and the most important hygiene to be
LoveJade1
A Teaching Guide for Those interested in teaching monkey beach
A Teaching Guide for Those interested in teaching monkey beachA Teaching Guide for Those interested in teaching monkey beach
A Teaching Guide for Those interested in teaching monkey beach
sethiserena
APNIC Update, presented by Joyce Chen at APTLD 87
APNIC Update, presented by Joyce Chen at APTLD 87APNIC Update, presented by Joyce Chen at APTLD 87
APNIC Update, presented by Joyce Chen at APTLD 87
APNIC
3d animation3d animation3d animation3d animation
3d animation3d animation3d animation3d animation3d animation3d animation3d animation3d animation
3d animation3d animation3d animation3d animation
animationkeemo21
JACKPOT TANGKI4D BERMAIN MENGGUNAKAN ID PRO 2025 TEPERCAYA LISENSI STAR GAMIN...
JACKPOT TANGKI4D BERMAIN MENGGUNAKAN ID PRO 2025 TEPERCAYA LISENSI STAR GAMIN...JACKPOT TANGKI4D BERMAIN MENGGUNAKAN ID PRO 2025 TEPERCAYA LISENSI STAR GAMIN...
JACKPOT TANGKI4D BERMAIN MENGGUNAKAN ID PRO 2025 TEPERCAYA LISENSI STAR GAMIN...
TANGKI4D
cyber hacking and cyber fraud by internet online money
cyber hacking and cyber fraud by internet online moneycyber hacking and cyber fraud by internet online money
cyber hacking and cyber fraud by internet online money
VEENAKSHI PATHAK
RIRs and the Next Chapter of Internet Growth - from IPv4 to IPv6
RIRs and the Next Chapter of Internet Growth - from IPv4 to IPv6RIRs and the Next Chapter of Internet Growth - from IPv4 to IPv6
RIRs and the Next Chapter of Internet Growth - from IPv4 to IPv6
APNIC
10 Critical Skills Kids Need in the AI Era
10 Critical Skills Kids Need in the AI Era10 Critical Skills Kids Need in the AI Era
10 Critical Skills Kids Need in the AI Era
RachelDines1
Here are the Top 10 Writers Of 2025 by GLCP
Here are the Top 10 Writers Of 2025 by GLCPHere are the Top 10 Writers Of 2025 by GLCP
Here are the Top 10 Writers Of 2025 by GLCP
glcppro
Building a Multiplatform SDKMAN in JavaFX.pdf
Building a Multiplatform SDKMAN in JavaFX.pdfBuilding a Multiplatform SDKMAN in JavaFX.pdf
Building a Multiplatform SDKMAN in JavaFX.pdf
Jago de Vreede
Shopify API Integration for Custom Analytics_ Advanced Metrics & Reporting Gu...
Shopify API Integration for Custom Analytics_ Advanced Metrics & Reporting Gu...Shopify API Integration for Custom Analytics_ Advanced Metrics & Reporting Gu...
Shopify API Integration for Custom Analytics_ Advanced Metrics & Reporting Gu...
CartCoders
QasyndaAIFinalVersionPresentationStartup
QasyndaAIFinalVersionPresentationStartupQasyndaAIFinalVersionPresentationStartup
QasyndaAIFinalVersionPresentationStartup
AidarIsakhanov
What Is the Difference Between the Internet and WAN.pdf
What Is the Difference Between the Internet and WAN.pdfWhat Is the Difference Between the Internet and WAN.pdf
What Is the Difference Between the Internet and WAN.pdf
Internet Bundle Now
phase_4_presentation[1] - Read-Only.pptx Iot
phase_4_presentation[1]  -  Read-Only.pptx Iotphase_4_presentation[1]  -  Read-Only.pptx Iot
phase_4_presentation[1] - Read-Only.pptx Iot
harshithamandya49
Hygiene-and-Sanitation with healthcare and the most important hygiene to be
Hygiene-and-Sanitation with healthcare and the most important hygiene to beHygiene-and-Sanitation with healthcare and the most important hygiene to be
Hygiene-and-Sanitation with healthcare and the most important hygiene to be
LoveJade1
A Teaching Guide for Those interested in teaching monkey beach
A Teaching Guide for Those interested in teaching monkey beachA Teaching Guide for Those interested in teaching monkey beach
A Teaching Guide for Those interested in teaching monkey beach
sethiserena
APNIC Update, presented by Joyce Chen at APTLD 87
APNIC Update, presented by Joyce Chen at APTLD 87APNIC Update, presented by Joyce Chen at APTLD 87
APNIC Update, presented by Joyce Chen at APTLD 87
APNIC

Css2layout

  • 2. Display property Block Inline Inline-Block Combined style like inline element, but we can set width, height. Others (list-item, table,inline-table,table-row,table-cell, none)
  • 3. Display property block Has width( or take all parent width), height (or stretch by content), always start at new line. Inline Go one by one, width always stretch by content, height = line- height property
  • 4. Display property Inline-block Has width(or stretch by content), height (or height = line-height property), go one by one.
  • 6. Box-sizing content-box (Default value) width, height for content only. Padding-box Width, height including padding Border-box Width, height including padding and border
  • 7. Margin margin: 20px; margin: 5px 10px 15px 20px; margin: 5px 10px 15px; margin: 10px auto; Collapsing vertical margin
  • 8. Relative Margins / Paddings .parent { border: 1px solid red; width: 300px; } .child { margin:20%; border: 1px solid green; } All margins will be 60px = 20% from parents width
  • 9. Float http://jsfiddle.net/ywRW6/5/ <div class="block"> Hello CODE! <div class="float"> float element </div> Can you see this? It's floated! </div> .float { float: left; background: #CCC; width: 200px; height: 200px; margin-right: 25px; padding: 10px; } img {float: right;}
  • 11. Position static (default) relative .box2 { position: relative; top: -5px; left: 10px; } fixed .fixed { position: fixed; bottom: 0; right: 0; width: 200px; }
  • 12. Position Absolute .relative { position: relative; width: 600px; height: 400px; } .absolute { position: absolute; top: 120px; right: 0; width: 300px; height: 200px; }
  • 13. Overflow visible hidden scroll auto text-overflow: ellipsis;
  • 14. Z-index <div class="block one"> Parent 5 <div class="block two"> Child 500 </div> </div> <div class="block three"> Absolute 10 </div> Stacking Context: 1)position != static ; z-index != auto 2)opacity <1 3)transform or perspective (CSS3)
  • 16. Table table { display: table } caption { display: table-caption } thead { display: table-header-group } tbody { display: table-row-group } tfoot { display: table-footer-group } tr { display: table-row } td, th { display: table-cell } <style> .header {height:60px; background-color:#717dc9; padding:20px; text-align:center} .left_col {width:120px; height:460px; background-color:#dddddd; padding:15px; vertical-align:top} .center_col {background-color:#ffffff; padding:15px; vertical-align:top} .right_col {width:120px; background-color:#dddddd; padding:15px; vertical-align:top} .footer {padding:10px 0 10px 20px; background-color:#717dc9; font-size:13px} </style> <table cellpadding="0" cellspacing="0" width="100%" align="center"> <tr><td colspan="3" class="header">My site</td></tr> <tr><td class="left_col">Left Menu</td><td class="center_col">Content streched to screen width</td> <td class="right_col">Right block</td></tr> <tr><td colspan="3" class="footer">&copy; All rights reserved</td></tr> </table>
  • 17. Table