SlideShare a Scribd company logo
Lecture 2 : CSS III SFDV2001 Web Development
Page layout with CSS Tables, though still heavily used by web designers to control page layout, were never intended for that purpose. Ideally tables should be used for data only. As browsers become better at supporting web standards and as users of the web adopt those browsers, layout controlled entirely by CSS is becoming an increasingly realistic option. Even when table layout is still necessary, CSS streamlines their use, and makes your code much cleaner.
Standard document flow When no layout control is implemented for an HTML page, elements flow from top to bottom, left to right: Block-level elements produce a line break that sees subsequent block-level elements come beneath them.  Inline elements come one after the other, left to right, in the order they appear. The order sequence is determined by the tag sequence in your HTML. When you expand or contract the browser window, block-level elements alter to fit the new width.
Standard document flow When you position elements with CSS you can remove an element from the normal flow. Order your HTML sensibly so that someone accessing it without style information can make sense of it: Title Navigation Main content Footer That order won’t affect what you can achieve with CSS with regard to layout.
Float In Transitional HTML we could align an image to the right and have text wrap around it on the left using the align attribute. In CSS such behaviour is not limited to images. You can float any element. ul#nav{ float: left; }
Clear Just as we had the  clear  attribute of  <br>  in transitional HTML to stop text from sitting beside an aligned image when we didn’t want it to, so we have  clear  to accompany  float  in CSS. The  clear  attribute of  <br>  had the possible values:  left ,  right  or  all . In CSS  clear  gets:  left ,  right ,  both ,  none  or  inherit . The  clear  property can only be applied to block-level elements.
Position There are a number of different values of  position  in CSS: Static Relative Absolute Fixed Static  is the normal (default) position of elements on your page. Elements conform to the standard document flow. Position (and any of its values) can apply to any element.
Position Once you have determined what kind of positioning an element will employ (relative, absolute or fixed), the actual positioning is done via four properties: Top Right Bottom Left The values of these properties can be a length or a percentage. Top  position refers to an elements distance  from  the top (the top of what depends on what kind of positioning you are employing).
position: relative; Relative positioning moves an element from its place in the standard document flow but retains the space where it came from: position: relative; top: 40px; left: 40px; 40 40
position: absolute; Absolute positioning moves an element from its place in the standard document flow and closes the space where it came from. An element is positioned absolutely with relation to its nearest parent element that isn’t statically positioned. position: absolute; top: 40px; left: 40px; 40 40
position: fixed; Like absolute positioning, fixed positioning removes an element from the standard document flow, but instead of being fixed relative to its parent element it is fixed in relation to the view-port (normally the browser window). Can be useful to recreate frame like behaviour where a navigation menu can stay fixed while the rest of the content scrolls. Not as well supported as relative and absolute positioning.
Position Combinations Relative and absolutely positioned elements in particular can be combined to give your layout greater flexibility. An absolutely positioned element inside a relative element is positioned absolutely with respect to that relatively positioned parent. So the parent may be flexible but the child always stays in the same place in relation to it. Time for an example I think.
CSS and tables Please don’t get the message “tables are evil”. Tables should absolutely be used for tabular data:
CSS and tables And they are still necessary for some layout purposes. Complex forms are still easier to control with a table than CSS (and in many instances the form information fits the tabular data description). When you have to use a table for layout control keep it as clean as possible; use your CSS to style it. Things like empty cells, though there were never very many good excuses for them, should be rare with CSS. Combining CSS and tables for layout can be more of a headache than using CSS alone, so don’t think you’re taking the easy route.
Learn by example And by practice. Lots and lots of practice. You could sit in a thousand lectures, read a thousand articles and still not really “get” CSS. You absolutely must practice it: work out how things do what they do through experiment. There is no learning experience like encountering a problem, getting incredibly frustrated and then feeling elated when you find a solution. You will not come out of this course an expert in CSS.
Recommended sites: Why Tables for Layout is Stupid: http:// www.hotdesign.com/seybold / A List Apart: Practical CSS Layout Tips, Ticks & techniques: http:// www.alistapart.com/articles/practicalcss / Max Design Floatutorial: http:// css.maxdesign.com.au/floatutorial / Further reading: Web Design in a Nutshell,  3rd Edition  by Jennifer Niederst Robbins
 
Ad

Recommended

Css position
Css position
Webtech Learning
 
Css Positioning Elements
Css Positioning Elements
sanjay2211
 
CSS Positioning and Features of CSS3
CSS Positioning and Features of CSS3
Jaimin Brahmbhatt
 
CSS Positioning
CSS Positioning
Nguyễn Trịnh Hồng Ngọc
 
Designing for the web - 101
Designing for the web - 101
Ashraf Hamdy
 
Web Development 3 (HTML & CSS)
Web Development 3 (HTML & CSS)
ghayour abbas
 
Node.js: perche' tutto questo hype?
Node.js: perche' tutto questo hype?
Giancarlo Valente
 
Introduction to Node.js: perspectives from a Drupal dev
Introduction to Node.js: perspectives from a Drupal dev
mcantelon
 
Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming
Tom Croucher
 
CSS corso base (classi seconde, mod 1)
CSS corso base (classi seconde, mod 1)
Matteo Ziviani
 
Introduzione ai css
Introduzione ai css
gianlucatroiani
 
Intro To Node.js
Intro To Node.js
Chris Cowan
 
Building servers with Node.js
Building servers with Node.js
ConFoo
 
Modern UI Development With Node.js
Modern UI Development With Node.js
Ryan Anklam
 
Page layout with css
Page layout with css
Er. Nawaraj Bhandari
 
Web Programming Basic topic.pptx
Web Programming Basic topic.pptx
ShouravPodder3
 
Css jon duckett - flashcards
Css jon duckett - flashcards
Chirag Aggarwal
 
Lecture 5 & 6 Advance CSS.pptx for web
Lecture 5 & 6 Advance CSS.pptx for web
ZahraWaheed9
 
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
Rafi Haidari
 
Advanced CSS.pptx
Advanced CSS.pptx
DiyonaVas
 
CSS3 PPT.pptx
CSS3 PPT.pptx
AchieversIT
 
Css training
Css training
Leigh Aucoin
 
Intro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
Srijan presentation on CSS
Srijan presentation on CSS
Shashank Merothiya
 
Floating
Floating
Danielle Larson
 
Floating power point
Floating power point
Danielle Larson
 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2
hstryk
 
Css
Css
NIRMAL FELIX
 
Floats
Floats
Diana Gabriela Cornelio
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
ghayour abbas
 

More Related Content

Viewers also liked (6)

Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming
Tom Croucher
 
CSS corso base (classi seconde, mod 1)
CSS corso base (classi seconde, mod 1)
Matteo Ziviani
 
Introduzione ai css
Introduzione ai css
gianlucatroiani
 
Intro To Node.js
Intro To Node.js
Chris Cowan
 
Building servers with Node.js
Building servers with Node.js
ConFoo
 
Modern UI Development With Node.js
Modern UI Development With Node.js
Ryan Anklam
 
Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming
Tom Croucher
 
CSS corso base (classi seconde, mod 1)
CSS corso base (classi seconde, mod 1)
Matteo Ziviani
 
Intro To Node.js
Intro To Node.js
Chris Cowan
 
Building servers with Node.js
Building servers with Node.js
ConFoo
 
Modern UI Development With Node.js
Modern UI Development With Node.js
Ryan Anklam
 

Similar to Lecture2 CSS 3 (20)

Page layout with css
Page layout with css
Er. Nawaraj Bhandari
 
Web Programming Basic topic.pptx
Web Programming Basic topic.pptx
ShouravPodder3
 
Css jon duckett - flashcards
Css jon duckett - flashcards
Chirag Aggarwal
 
Lecture 5 & 6 Advance CSS.pptx for web
Lecture 5 & 6 Advance CSS.pptx for web
ZahraWaheed9
 
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
Rafi Haidari
 
Advanced CSS.pptx
Advanced CSS.pptx
DiyonaVas
 
CSS3 PPT.pptx
CSS3 PPT.pptx
AchieversIT
 
Css training
Css training
Leigh Aucoin
 
Intro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
Srijan presentation on CSS
Srijan presentation on CSS
Shashank Merothiya
 
Floating
Floating
Danielle Larson
 
Floating power point
Floating power point
Danielle Larson
 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2
hstryk
 
Css
Css
NIRMAL FELIX
 
Floats
Floats
Diana Gabriela Cornelio
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
ghayour abbas
 
Web Development 4
Web Development 4
ghayour abbas
 
Margin vs Padding.pdf
Margin vs Padding.pdf
WebMaxy
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
Andolasoft Inc
 
Design and CSS
Design and CSS
nolly00
 
Web Programming Basic topic.pptx
Web Programming Basic topic.pptx
ShouravPodder3
 
Css jon duckett - flashcards
Css jon duckett - flashcards
Chirag Aggarwal
 
Lecture 5 & 6 Advance CSS.pptx for web
Lecture 5 & 6 Advance CSS.pptx for web
ZahraWaheed9
 
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
Rafi Haidari
 
Advanced CSS.pptx
Advanced CSS.pptx
DiyonaVas
 
Intro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2
hstryk
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
ghayour abbas
 
Margin vs Padding.pdf
Margin vs Padding.pdf
WebMaxy
 
Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
Andolasoft Inc
 
Design and CSS
Design and CSS
nolly00
 
Ad

More from Sur College of Applied Sciences (15)

Lecture11 A Image
Lecture11 A Image
Sur College of Applied Sciences
 
Lecture 11 B Security
Lecture 11 B Security
Sur College of Applied Sciences
 
Lecture 10 Image Format
Lecture 10 Image Format
Sur College of Applied Sciences
 
Lecture 9 Usability Orignal
Lecture 9 Usability Orignal
Sur College of Applied Sciences
 
Lecture 9 Professional Practices
Lecture 9 Professional Practices
Sur College of Applied Sciences
 
Lecture 9 Accessibility Original
Lecture 9 Accessibility Original
Sur College of Applied Sciences
 
Accessibility Usability Professional Summry
Accessibility Usability Professional Summry
Sur College of Applied Sciences
 
Lecture 8 Video
Lecture 8 Video
Sur College of Applied Sciences
 
Lecture 6 Data Driven Design
Lecture 6 Data Driven Design
Sur College of Applied Sciences
 
Lecture 5 XML
Lecture 5 XML
Sur College of Applied Sciences
 
Lecture2 CSS 2
Lecture2 CSS 2
Sur College of Applied Sciences
 
Lecture2 CSS1
Lecture2 CSS1
Sur College of Applied Sciences
 
Lecture1 B Frames&Forms
Lecture1 B Frames&Forms
Sur College of Applied Sciences
 
Navigation1 A
Navigation1 A
Sur College of Applied Sciences
 
Lecture 3 Javascript1
Lecture 3 Javascript1
Sur College of Applied Sciences
 
Ad

Recently uploaded (20)

THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
How to Customize Quotation Layouts in Odoo 18
How to Customize Quotation Layouts in Odoo 18
Celine George
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
June 2025 Progress Update With Board Call_In process.pptx
June 2025 Progress Update With Board Call_In process.pptx
International Society of Service Innovation Professionals
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
List View Components in Odoo 18 - Odoo Slides
List View Components in Odoo 18 - Odoo Slides
Celine George
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
Q1_ENGLISH_PPT_WEEK 1 power point grade 3 Quarter 1 week 1
jutaydeonne
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
How to Customize Quotation Layouts in Odoo 18
How to Customize Quotation Layouts in Odoo 18
Celine George
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
This is why students from these 44 institutions have not received National Se...
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
List View Components in Odoo 18 - Odoo Slides
List View Components in Odoo 18 - Odoo Slides
Celine George
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 

Lecture2 CSS 3

  • 1. Lecture 2 : CSS III SFDV2001 Web Development
  • 2. Page layout with CSS Tables, though still heavily used by web designers to control page layout, were never intended for that purpose. Ideally tables should be used for data only. As browsers become better at supporting web standards and as users of the web adopt those browsers, layout controlled entirely by CSS is becoming an increasingly realistic option. Even when table layout is still necessary, CSS streamlines their use, and makes your code much cleaner.
  • 3. Standard document flow When no layout control is implemented for an HTML page, elements flow from top to bottom, left to right: Block-level elements produce a line break that sees subsequent block-level elements come beneath them. Inline elements come one after the other, left to right, in the order they appear. The order sequence is determined by the tag sequence in your HTML. When you expand or contract the browser window, block-level elements alter to fit the new width.
  • 4. Standard document flow When you position elements with CSS you can remove an element from the normal flow. Order your HTML sensibly so that someone accessing it without style information can make sense of it: Title Navigation Main content Footer That order won’t affect what you can achieve with CSS with regard to layout.
  • 5. Float In Transitional HTML we could align an image to the right and have text wrap around it on the left using the align attribute. In CSS such behaviour is not limited to images. You can float any element. ul#nav{ float: left; }
  • 6. Clear Just as we had the clear attribute of <br> in transitional HTML to stop text from sitting beside an aligned image when we didn’t want it to, so we have clear to accompany float in CSS. The clear attribute of <br> had the possible values: left , right or all . In CSS clear gets: left , right , both , none or inherit . The clear property can only be applied to block-level elements.
  • 7. Position There are a number of different values of position in CSS: Static Relative Absolute Fixed Static is the normal (default) position of elements on your page. Elements conform to the standard document flow. Position (and any of its values) can apply to any element.
  • 8. Position Once you have determined what kind of positioning an element will employ (relative, absolute or fixed), the actual positioning is done via four properties: Top Right Bottom Left The values of these properties can be a length or a percentage. Top position refers to an elements distance from the top (the top of what depends on what kind of positioning you are employing).
  • 9. position: relative; Relative positioning moves an element from its place in the standard document flow but retains the space where it came from: position: relative; top: 40px; left: 40px; 40 40
  • 10. position: absolute; Absolute positioning moves an element from its place in the standard document flow and closes the space where it came from. An element is positioned absolutely with relation to its nearest parent element that isn’t statically positioned. position: absolute; top: 40px; left: 40px; 40 40
  • 11. position: fixed; Like absolute positioning, fixed positioning removes an element from the standard document flow, but instead of being fixed relative to its parent element it is fixed in relation to the view-port (normally the browser window). Can be useful to recreate frame like behaviour where a navigation menu can stay fixed while the rest of the content scrolls. Not as well supported as relative and absolute positioning.
  • 12. Position Combinations Relative and absolutely positioned elements in particular can be combined to give your layout greater flexibility. An absolutely positioned element inside a relative element is positioned absolutely with respect to that relatively positioned parent. So the parent may be flexible but the child always stays in the same place in relation to it. Time for an example I think.
  • 13. CSS and tables Please don’t get the message “tables are evil”. Tables should absolutely be used for tabular data:
  • 14. CSS and tables And they are still necessary for some layout purposes. Complex forms are still easier to control with a table than CSS (and in many instances the form information fits the tabular data description). When you have to use a table for layout control keep it as clean as possible; use your CSS to style it. Things like empty cells, though there were never very many good excuses for them, should be rare with CSS. Combining CSS and tables for layout can be more of a headache than using CSS alone, so don’t think you’re taking the easy route.
  • 15. Learn by example And by practice. Lots and lots of practice. You could sit in a thousand lectures, read a thousand articles and still not really “get” CSS. You absolutely must practice it: work out how things do what they do through experiment. There is no learning experience like encountering a problem, getting incredibly frustrated and then feeling elated when you find a solution. You will not come out of this course an expert in CSS.
  • 16. Recommended sites: Why Tables for Layout is Stupid: http:// www.hotdesign.com/seybold / A List Apart: Practical CSS Layout Tips, Ticks & techniques: http:// www.alistapart.com/articles/practicalcss / Max Design Floatutorial: http:// css.maxdesign.com.au/floatutorial / Further reading: Web Design in a Nutshell, 3rd Edition by Jennifer Niederst Robbins
  • 17.  

Editor's Notes

  • #3: Show google.comcode before and after (in Google directory). Show: Why tables for layout is stupid: http://www.hotdesign.com/seybold/
  • #5: Show 112 index.html without style sheet.
  • #6: Show lab three example Show examples: Nofloat.html - normal flow of document Basicfloat.html - nav ul floated and a border added so area can be seen. Float.html - bells and whistles.
  • #7: Show float.html again and discuss use of clear for footer.
  • #10: Show Position&gt; relative.html
  • #11: Show Position&gt; absolute.html
  • #12: Show fixed.html and Women in CS site.
  • #13: Show fixed.html and Women in CS site (http://www.cs.otago.ac.nz/staffpriv/morag/femmeweb/).
  • #16: Show sites with layout examples.