SlideShare a Scribd company logo
Using CSS and <div> tags  for page layout
In Lab1 we used tables to define how the page layout will look. Works fine but if asked to redesign it is difficult to modify. A <div> tag combined with CSS will create a page that is easy to manage and manipulate later. A <div> tag defines a division or section in a HTML document It is often used to group block elements to format them with styles. The <div> tag is supported in all major browsers
The <div> tag is a block level element The <div> tag can contain nearly any other tag The <div> tag cannot be inside <p> tags  The <div> tag is not a replacement <p> tag The <p> tag is for paragraphs only while <div> tag defines more general divisions within a document Don’t replace <p> tags with <div> tags Good idea to label your <div> tags as you place them in the document Also good idea to close your <div> tags as soon as you open them, then place the contents within the element
Site logo at top left The logo appears at the top left and also acts as a hyperlink back to sites home page Navigation bar This incorporates the site logo in a top horizontal navigation bar but also has a left hand side navigation bar . Breadcrumbs breadcrumbs tell the user where they are relative to the home page. Also the components of the breadcrumb list should be hyperlinked. Three-region layout uses the above patterns where there is a site logo, navigation bar top and left (and maybe breadcrumbs) and a third section for content
breadcrumbs Left navigation logo search Main content Right side content
Left navigation logo Main content Top navigation
Just  setting up three separate <div>  like in the code below will not result in the page being laid out correctly
To get the divisions positioned correctly you need to use CSS
Need to add the link into the code div_styles.css
This shows the three divisions but they are not lined up all that well. We need to understand a little more about how “float” works
float property allows you to position your web page designs Can only float block-level elements  eg <img />, <p> </p>, <ul> </ul>, and  <div> </div> Can float to either the left or right. Any element that follows the floated element will flow around the floated element on the other side. Should always define the width of a floated element A floated element will move as far to the left or right of the container element as it can. If the container element is the <body> tag the floated div will sit on the margin on the page If the container element itself is contained by something else the floated div will sit on the margin of the container We are going to add a “wrapper” div to our previous eg.
The next slide shows the CSS wrapper  div
Page Layout 2010
Finally if you would like your layout to be centred then you centre the wrapper div by setting the left and right margin to be equal
(a)  Create the following web page using <div> tags and CSS.  Choose your own colours and fonts  300px wide 300px wide
(b)  Modify the code from part (a) and place a wrapper class around the two divs and centre them.
(a)  Create the following web page using <div> tags and CSS.  Choose your own colours and fonts  Download the Act10 images folder from the MyChisholm web site
You are going to change the way Lab2 is set up and now use <div> tags and CSS  (rather than a table) to layout your page. This means your XHTML and your CSS file will both need to be modified  Reminder: The site consists of four pages: welcome.html baked_pears.html pumpkin_creme_brulee.html contact_me.html These pages are shown over the next four slides
header <div> left_nav <div> content <div>
Page Layout 2010
Page Layout 2010
Page Layout 2010
In this section you learnt how to use <div> tags and  CSS to layout a  web page. Covered: <div> tags float property CSS Design patterns The next section looks at how to make your page more interactive by adding javaScript to your page

More Related Content

PPT
Print CSS
PPT
Lesson 2 cs5
PPT
Paragraphs and formatting
PPTX
Html presentation
PPT
HTML Advanced
PPT
HTML Intermediate
PPTX
Web Page Designing
Print CSS
Lesson 2 cs5
Paragraphs and formatting
Html presentation
HTML Advanced
HTML Intermediate
Web Page Designing

What's hot (15)

PPTX
Module 2
PPSX
HTML + CSS Examples
PDF
CSS in HTML
PPTX
HTML Basics 1 workshop
PPT
Html2 Intro
DOCX
Project report
PPTX
Div Tag Tutorial
PPT
Higher Computing Science HTML
PPTX
Css presentation
PPT
Intro to html
PPT
Unit 2.3 Part 2
PPT
Higher Computing Science CSS
PPTX
HTML semantics
PPT
Module 2
HTML + CSS Examples
CSS in HTML
HTML Basics 1 workshop
Html2 Intro
Project report
Div Tag Tutorial
Higher Computing Science HTML
Css presentation
Intro to html
Unit 2.3 Part 2
Higher Computing Science CSS
HTML semantics
Ad

Viewers also liked (20)

PPTX
Lesson One Fourth Quarter Fourth Year High School CSS Modern Layout and Style
PPTX
Introduction to computers
PPT
Css page layout
PPTX
The Box Model [CSS Introduction]
PDF
CSS Box Model and Dimensions
PPTX
Css box-model
PPT
Introduction to computers new 2010
PPTX
The CSS Box Model
PPTX
End User Computing (EUC)
PPT
Introduction To Computers
PPTX
CSS Layout Techniques
PPT
Chapter 01 - Introduction to Computers
PPSX
CSS Box Model Presentation
PDF
CSS Box Model
PDF
Css box model
PDF
CSS Layouting #3 : Box Model
PDF
Template & Content Control (Basics) - Microsoft Word 2013
PPT
Introduction to computers
PPT
CSS, CSS Selectors, CSS Box Model
PDF
Introduction to computers pdf
Lesson One Fourth Quarter Fourth Year High School CSS Modern Layout and Style
Introduction to computers
Css page layout
The Box Model [CSS Introduction]
CSS Box Model and Dimensions
Css box-model
Introduction to computers new 2010
The CSS Box Model
End User Computing (EUC)
Introduction To Computers
CSS Layout Techniques
Chapter 01 - Introduction to Computers
CSS Box Model Presentation
CSS Box Model
Css box model
CSS Layouting #3 : Box Model
Template & Content Control (Basics) - Microsoft Word 2013
Introduction to computers
CSS, CSS Selectors, CSS Box Model
Introduction to computers pdf
Ad

Similar to Page Layout 2010 (20)

ODP
Creating Web Sites with HTML and CSS
PPTX
Castro Chapter 11
PPTX
CSS Layout Tutorial
PDF
Web Layout
PPT
Introduction to HTML
PPTX
Cascading Style Sheets CSS
PPT
Slice and Dice
PPTX
HTML5- Create divisions in a web page
PDF
The Future of CSS Layout
PDF
Class 3 create an absolute layout with css abs position (aptana)
PPTX
Webdesign
PPTX
PDF
PPT
Css layouts-continued
PPT
Lecture 2 - Comm Lab: Web @ ITP
PPT
How Cascading Style Sheets (CSS) Works
PDF
Maintainable CSS
PDF
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
PPTX
Class 10
Creating Web Sites with HTML and CSS
Castro Chapter 11
CSS Layout Tutorial
Web Layout
Introduction to HTML
Cascading Style Sheets CSS
Slice and Dice
HTML5- Create divisions in a web page
The Future of CSS Layout
Class 3 create an absolute layout with css abs position (aptana)
Webdesign
Css layouts-continued
Lecture 2 - Comm Lab: Web @ ITP
How Cascading Style Sheets (CSS) Works
Maintainable CSS
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Class 10

More from Cathie101 (20)

PPT
Css 2010
PPT
Xhtml 2010
PPT
Dynamic Web Pages Ch 8 V1.0
PPT
Dynamic Web Pages Ch 6 V1.0
PPT
Dynamic Web Pages Ch 1 V1.0
PPT
Dynamic Web Pages Ch 9 V1.0
PPT
Dynamic Web Pages Ch 7 V1.0
PPT
Dynamic Web Pages Ch 5 V1.0
PPT
Dynamic Web Pages Ch 4 V1.0
PPT
Dynamic Web Pages Ch 3 V1.0
PPT
Dynamic Web Pages Ch 2 V1.0
PDF
Dynamic Web Pages 2009v2.1
DOC
Database Fdd
DOC
Sql All Tuts 2009
DOC
Database Fdd
DOC
Database Er
PPT
Database Design E R 2009
PPT
Database Design Fdd 2009
PPTX
Database Design E R 2009
DOC
Overall Computer Systems 2nd Year 2009
Css 2010
Xhtml 2010
Dynamic Web Pages Ch 8 V1.0
Dynamic Web Pages Ch 6 V1.0
Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 9 V1.0
Dynamic Web Pages Ch 7 V1.0
Dynamic Web Pages Ch 5 V1.0
Dynamic Web Pages Ch 4 V1.0
Dynamic Web Pages Ch 3 V1.0
Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages 2009v2.1
Database Fdd
Sql All Tuts 2009
Database Fdd
Database Er
Database Design E R 2009
Database Design Fdd 2009
Database Design E R 2009
Overall Computer Systems 2nd Year 2009

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
A Presentation on Artificial Intelligence
PDF
cuic standard and advanced reporting.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
KodekX | Application Modernization Development
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Big Data Technologies - Introduction.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Understanding_Digital_Forensics_Presentation.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
A Presentation on Artificial Intelligence
cuic standard and advanced reporting.pdf
Review of recent advances in non-invasive hemoglobin estimation
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
NewMind AI Monthly Chronicles - July 2025
Building Integrated photovoltaic BIPV_UPV.pdf
Empathic Computing: Creating Shared Understanding
KodekX | Application Modernization Development

Page Layout 2010

  • 1. Using CSS and <div> tags for page layout
  • 2. In Lab1 we used tables to define how the page layout will look. Works fine but if asked to redesign it is difficult to modify. A <div> tag combined with CSS will create a page that is easy to manage and manipulate later. A <div> tag defines a division or section in a HTML document It is often used to group block elements to format them with styles. The <div> tag is supported in all major browsers
  • 3. The <div> tag is a block level element The <div> tag can contain nearly any other tag The <div> tag cannot be inside <p> tags The <div> tag is not a replacement <p> tag The <p> tag is for paragraphs only while <div> tag defines more general divisions within a document Don’t replace <p> tags with <div> tags Good idea to label your <div> tags as you place them in the document Also good idea to close your <div> tags as soon as you open them, then place the contents within the element
  • 4. Site logo at top left The logo appears at the top left and also acts as a hyperlink back to sites home page Navigation bar This incorporates the site logo in a top horizontal navigation bar but also has a left hand side navigation bar . Breadcrumbs breadcrumbs tell the user where they are relative to the home page. Also the components of the breadcrumb list should be hyperlinked. Three-region layout uses the above patterns where there is a site logo, navigation bar top and left (and maybe breadcrumbs) and a third section for content
  • 5. breadcrumbs Left navigation logo search Main content Right side content
  • 6. Left navigation logo Main content Top navigation
  • 7. Just setting up three separate <div> like in the code below will not result in the page being laid out correctly
  • 8. To get the divisions positioned correctly you need to use CSS
  • 9. Need to add the link into the code div_styles.css
  • 10. This shows the three divisions but they are not lined up all that well. We need to understand a little more about how “float” works
  • 11. float property allows you to position your web page designs Can only float block-level elements eg <img />, <p> </p>, <ul> </ul>, and <div> </div> Can float to either the left or right. Any element that follows the floated element will flow around the floated element on the other side. Should always define the width of a floated element A floated element will move as far to the left or right of the container element as it can. If the container element is the <body> tag the floated div will sit on the margin on the page If the container element itself is contained by something else the floated div will sit on the margin of the container We are going to add a “wrapper” div to our previous eg.
  • 12. The next slide shows the CSS wrapper div
  • 14. Finally if you would like your layout to be centred then you centre the wrapper div by setting the left and right margin to be equal
  • 15. (a) Create the following web page using <div> tags and CSS. Choose your own colours and fonts 300px wide 300px wide
  • 16. (b) Modify the code from part (a) and place a wrapper class around the two divs and centre them.
  • 17. (a) Create the following web page using <div> tags and CSS. Choose your own colours and fonts Download the Act10 images folder from the MyChisholm web site
  • 18. You are going to change the way Lab2 is set up and now use <div> tags and CSS (rather than a table) to layout your page. This means your XHTML and your CSS file will both need to be modified Reminder: The site consists of four pages: welcome.html baked_pears.html pumpkin_creme_brulee.html contact_me.html These pages are shown over the next four slides
  • 19. header <div> left_nav <div> content <div>
  • 23. In this section you learnt how to use <div> tags and CSS to layout a web page. Covered: <div> tags float property CSS Design patterns The next section looks at how to make your page more interactive by adding javaScript to your page