SlideShare 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 parent’s 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

PPT
CSS for basic learner
PDF
Intro to html, css & sass
PPT
Css
PPTX
Css intro
PPTX
CSS Walktrough Internship Course
PDF
Intro to HTML + CSS
PDF
CSS and Layout
PPTX
Cascading style sheets - CSS
CSS for basic learner
Intro to html, css & sass
Css
Css intro
CSS Walktrough Internship Course
Intro to HTML + CSS
CSS and Layout
Cascading style sheets - CSS

What's hot (20)

PPTX
Css box-model
PPTX
CSS Basics part One
PPTX
CSS tutorial chapter 3
PPTX
CSS tutorial chapter 2
PPTX
Web 102 INtro to CSS
PPTX
Cascading Style Sheets - CSS
PDF
Intro to CSS
PPTX
Css training
PDF
CSS Box Model and Dimensions
PPTX
Web Engineering - Basic CSS Properties
PDF
Ppt ch06
PPTX
Css
PPSX
CSS Box Model Presentation
PPTX
Css
PDF
Lesson 02
PPTX
css v1 guru
PPTX
Understanding CSS for web development by software outsourcing company india
PPT
Website with HTML CSS
PPTX
CSS Cascade Style Sheet
PDF
Web Design Course: CSS lecture 4
Css box-model
CSS Basics part One
CSS tutorial chapter 3
CSS tutorial chapter 2
Web 102 INtro to CSS
Cascading Style Sheets - CSS
Intro to CSS
Css training
CSS Box Model and Dimensions
Web Engineering - Basic CSS Properties
Ppt ch06
Css
CSS Box Model Presentation
Css
Lesson 02
css v1 guru
Understanding CSS for web development by software outsourcing company india
Website with HTML CSS
CSS Cascade Style Sheet
Web Design Course: CSS lecture 4
Ad

Similar to Css2layout (20)

PDF
Web Layout
PPTX
CSS Position and it’s values
PDF
CSS3 Refresher
KEY
CSS and CSS3
PPTX
Web Development - Lecture 6
PPT
Lecture5.ppt C style sheet notes for B.CA and BIT
PPTX
CSS Positioning and Features of CSS3
PPT
Introduction to HTML
PDF
Implementing Awesome: An HTML5/CSS3 Workshop
PPT
animation for designing elements and botto
PPTX
Lecture 6.pptx..........................
PDF
UI 101
PDF
HTML5 and CSS3 Refresher
PDF
Web Design Course: CSS lecture 5
PPTX
CSS3 TTA (Transform Transition Animation)
PPTX
Advanced css for designing responsive web page on website
PPT
Tutorial0eesrtjfzjgxkgxkxxkxkgxkgxjffj3.ppt
PPTX
Css & css3
Β 
PPTX
Lecture-8.pptx
PPTX
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Web Layout
CSS Position and it’s values
CSS3 Refresher
CSS and CSS3
Web Development - Lecture 6
Lecture5.ppt C style sheet notes for B.CA and BIT
CSS Positioning and Features of CSS3
Introduction to HTML
Implementing Awesome: An HTML5/CSS3 Workshop
animation for designing elements and botto
Lecture 6.pptx..........................
UI 101
HTML5 and CSS3 Refresher
Web Design Course: CSS lecture 5
CSS3 TTA (Transform Transition Animation)
Advanced css for designing responsive web page on website
Tutorial0eesrtjfzjgxkgxkxxkxkgxkgxjffj3.ppt
Css & css3
Β 
Lecture-8.pptx
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Ad

More from Vadim Spiridenko (6)

PPTX
Css5 canvas
PPTX
Css6 svg
PPTX
Css3animation
PPTX
Css4less
PPTX
PPTX
Css5 canvas
Css6 svg
Css3animation
Css4less

Recently uploaded (20)

PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
Β 
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
The Internet -By the Numbers, Sri Lanka Edition
Β 
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
Paper PDF World Game (s) Great Redesign.pdf
DOCX
Unit-3 cyber security network security of internet system
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
artificial intelligence overview of it and more
PPTX
international classification of diseases ICD-10 review PPT.pptx
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PDF
Testing WebRTC applications at scale.pdf
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Power Point - Lesson 3_2.pptx grad school presentation
Β 
PptxGenJS_Demo_Chart_20250317130215833.pptx
The Internet -By the Numbers, Sri Lanka Edition
Β 
Introuction about ICD -10 and ICD-11 PPT.pptx
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Paper PDF World Game (s) Great Redesign.pdf
Unit-3 cyber security network security of internet system
522797556-Unit-2-Temperature-measurement-1-1.pptx
The New Creative Director: How AI Tools for Social Media Content Creation Are...
artificial intelligence overview of it and more
international classification of diseases ICD-10 review PPT.pptx
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Module 1 - Cyber Law and Ethics 101.pptx
Testing WebRTC applications at scale.pdf
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
INTERNET------BASICS-------UPDATED PPT PRESENTATION
SAP Ariba Sourcing PPT for learning material
Introuction about WHO-FIC in ICD-10.pptx
Job_Card_System_Styled_lorem_ipsum_.pptx

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 parent’s 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