SlideShare a Scribd company logo
1 of 33
Download to read offline
BEGINNING HTML AND CSS
HTML/CSS ~ Girl Develop It ~
CLASS 3
WHAT WE'LL LEARN IN THIS SECTION
Parts of a web page
The <div> element
The box model
Padding, margin and borders
PARTS OF A WEB PAGE
Nearly every web page is
divided into four parts:
header
footer
sidebar
content area
THE DIV ELEMENT
Divs let us organize web content into relevant parts —
the 4 main parts and smaller areas, as well.
Example: <div id="header">
With divs, we group elements so they can be styled the
same way.
We give divs ids and classes so we can style them
using CSS.
OTHER ELEMENTS ARE OFTEN NESTED
INSIDE DIVS
<div>
<p>Content<p>
<p>Content<p>
</div>
<div id="header">
<h1>Main Heading<h1>
</div>
<div class="sub-content">
<p>Some more content<p>
</div>
CASE STUDY:
You want the first 2 paragraphs of your webpage to be
right-aligned, green & italic, but you don't want these
styles to be applied to any other paragraphs:
THE HTML:
<div class="special_styles">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
<p>Sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
<p>Magna aliqua. Ut enim ad minim veniam.</p>
<p>Quis nostrud exercitation ullamco.</p>

THE CSS:
.special_styles {
text-align:right;
color: green;
font-style: italic;
}
THE RESULT
Lorem ipsum dolor sit amet, consectetur adipisicing elit
Sed do eiusmod tempor incididunt ut labore et dolore.
Magna aliqua. Ut enim ad minim veniam.
Quis nostrud exercitation ullamco.
.special_styles {
text-align:right;
color: green;
font-style: italic;
}
LET'S DEVELOP IT
Organize your web page into 4 parts using <div>'s:
header — footer — sidebar — content
Give each new div an id with the name that corresponds
to its part.
hint: sidebars are a good place for lists.
hint: for a footer, add a "copyright" with your name and the year
to the bottom of your page.
BOX MODEL
PADDING:
The space between the border and the content
Makes the box "wider" (adds to the total width.)
PADDING
To make the padding on all sides the same, use the
"padding" property and one value
padding: 15px;
Or you can style the sides individually
padding-top: 10px;
padding-bottom: 20px;
padding-left: 25px;
padding-right: 8px;
PADDING SHORTHAND
You can also use shorthand to style the sides in one
declaration
padding: 10px 5px 3px 5px;
is the same as:
padding-top: 10px;
padding-right: 5px;
padding-bottom: 3px;
padding-left: 5px;
The order is: top right bottom left
PADDING SHORTHAND
If the top and bottom padding are the same, and the left
and right are the same, you can use two values:
padding: 30px 50px;
is the same as:
padding-top: 30px;
padding-right: 50px;
padding-bottom: 30px;
padding-left: 50px;
The order is: top/bottom right/left
BORDER:
Between padding and margin.
border-width — border-style — border-color
BORDERS
border-width
border-style
border-color
Example:
border-width: 10px;
border-style: dashed;
border-color: #666666;
BORDER STYLE SHORTHAND
You can specify each property separately, or all three
together.
EXAMPLE:
A solid red border:
border: 1px solid #ff0000;
BORDER STYLE SHORTHAND
You can specify separate styles for the top, left, right or
bottom border
EXAMPLES:
A thick dotted black top border:
border-top: 4px dotted #000000;
Two different border styles:
border-top: 1px solid #ff0000;
border-bottom: 4px dotted #000000;
MARGIN
The transparent area around the box that separates it
from other elements.
MARGINS
Styled just like padding!
margin: 15px;
Or you can style the sides individually
margin-top: 10px;
margin-bottom: 20px;
margin-left: 25px;
margin-right: 8px;
MARGIN SHORTHAND
Same as padding!
margin: 10px 5px 3px 5px;
is the same as:
margin-top: 10px;
margin-right: 5px;
margin-bottom: 3px;
margin-left: 5px;
The order is: top right bottom left
MARGIN SHORTHAND
Like padding, if the top and bottom margin are the same,
and the left and right are the same, you can use two
values:
margin: 30px 50px;
is the same as:
margin-top: 30px;
margin-right: 50px;
margin-bottom: 30px;
margin-left: 50px;
The order is: top/bottom right/left
AUTO MARGIN
If a margin is set to auto on a box that has width, it will
take up as much space as possible.
This will "center" the box:
margin: auto;
width: 300px;
This will put the box on the right:
margin-left: auto;
margin-right: 5px;
width: 300px;
WIDTH AND HEIGHT
width: 600px;
Sets the width of an element to 600px.
height: 300px;
Sets the height of an element to 300px.
These only refer to the content area. Padding and border
will add to the height and/or width.
LET'S TAKE A LOOK AT A DEMO!
of padding, borders, margins, widths and heights.
QUESTIONS?

?
GDI Seattle Intro to HTML and CSS - Class 3

More Related Content

Viewers also liked

Viewers also liked (6)

áLbum de fotografías moda
áLbum de fotografías modaáLbum de fotografías moda
áLbum de fotografías moda
 
7 habits of highly effective people
7 habits of highly effective people7 habits of highly effective people
7 habits of highly effective people
 
Pic pas demo
Pic pas demoPic pas demo
Pic pas demo
 
京东商城Pop商品搜索原理
京东商城Pop商品搜索原理京东商城Pop商品搜索原理
京东商城Pop商品搜索原理
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
 

Similar to GDI Seattle Intro to HTML and CSS - Class 3

Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSS
BG Java EE Course
 
Class 3 create an absolute layout with css abs position (aptana)
Class 3  create an absolute layout with css abs position (aptana)Class 3  create an absolute layout with css abs position (aptana)
Class 3 create an absolute layout with css abs position (aptana)
Erin M. Kidwell
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
Bulldogs83
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
Bulldogs83
 

Similar to GDI Seattle Intro to HTML and CSS - Class 3 (20)

CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Layouts
Layouts Layouts
Layouts
 
Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSS
 
CSS Box Model Presentation
CSS Box Model PresentationCSS Box Model Presentation
CSS Box Model Presentation
 
Css tips & tricks
Css tips & tricksCss tips & tricks
Css tips & tricks
 
CSS3 notes
CSS3 notesCSS3 notes
CSS3 notes
 
Streamlining Website Development in Dreamweaver
Streamlining Website Development in DreamweaverStreamlining Website Development in Dreamweaver
Streamlining Website Development in Dreamweaver
 
CSS
CSSCSS
CSS
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt
 
Class 3 create an absolute layout with css abs position (aptana)
Class 3  create an absolute layout with css abs position (aptana)Class 3  create an absolute layout with css abs position (aptana)
Class 3 create an absolute layout with css abs position (aptana)
 
css-note.pptx
css-note.pptxcss-note.pptx
css-note.pptx
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
CSS and Layout
CSS and LayoutCSS and Layout
CSS and Layout
 
Html n css tutorial
Html n css tutorialHtml n css tutorial
Html n css tutorial
 
CSS
CSSCSS
CSS
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
Web - CSS 1.pptx
Web - CSS 1.pptxWeb - CSS 1.pptx
Web - CSS 1.pptx
 
6_CasCadingStylesSheetsCSS.ppt
6_CasCadingStylesSheetsCSS.ppt6_CasCadingStylesSheetsCSS.ppt
6_CasCadingStylesSheetsCSS.ppt
 

More from Heather Rock (7)

GDI Seattle - Web Accessibility Class 1
GDI Seattle - Web Accessibility Class 1GDI Seattle - Web Accessibility Class 1
GDI Seattle - Web Accessibility Class 1
 
GDI Seattle - Intro to JavaScript Class 2
GDI Seattle - Intro to JavaScript Class 2GDI Seattle - Intro to JavaScript Class 2
GDI Seattle - Intro to JavaScript Class 2
 
GDI Seattle - Intro to JavaScript Class 1
GDI Seattle - Intro to JavaScript Class 1GDI Seattle - Intro to JavaScript Class 1
GDI Seattle - Intro to JavaScript Class 1
 
GDI Seattle Intro to HTML and CSS - Class 4
GDI Seattle Intro to HTML and CSS - Class 4GDI Seattle Intro to HTML and CSS - Class 4
GDI Seattle Intro to HTML and CSS - Class 4
 
GDI Seattle - Intermediate HTML and CSS Class 3 Slides
GDI Seattle - Intermediate HTML and CSS Class 3 SlidesGDI Seattle - Intermediate HTML and CSS Class 3 Slides
GDI Seattle - Intermediate HTML and CSS Class 3 Slides
 
Intro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 SlidesIntro to HTML and CSS - Class 2 Slides
Intro to HTML and CSS - Class 2 Slides
 
GDI Seattle Intro to HTML and CSS - Class 1
GDI Seattle Intro to HTML and CSS - Class 1GDI Seattle Intro to HTML and CSS - Class 1
GDI Seattle Intro to HTML and CSS - Class 1
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

GDI Seattle Intro to HTML and CSS - Class 3

  • 1. BEGINNING HTML AND CSS HTML/CSS ~ Girl Develop It ~
  • 3. WHAT WE'LL LEARN IN THIS SECTION Parts of a web page The <div> element The box model Padding, margin and borders
  • 4. PARTS OF A WEB PAGE Nearly every web page is divided into four parts: header footer sidebar content area
  • 5. THE DIV ELEMENT Divs let us organize web content into relevant parts — the 4 main parts and smaller areas, as well. Example: <div id="header"> With divs, we group elements so they can be styled the same way. We give divs ids and classes so we can style them using CSS.
  • 6. OTHER ELEMENTS ARE OFTEN NESTED INSIDE DIVS <div> <p>Content<p> <p>Content<p> </div> <div id="header"> <h1>Main Heading<h1> </div> <div class="sub-content"> <p>Some more content<p> </div>
  • 7.
  • 8. CASE STUDY: You want the first 2 paragraphs of your webpage to be right-aligned, green & italic, but you don't want these styles to be applied to any other paragraphs:
  • 9. THE HTML: <div class="special_styles"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p> <p>Sed do eiusmod tempor incididunt ut labore et dolore.</p> </div> <p>Magna aliqua. Ut enim ad minim veniam.</p> <p>Quis nostrud exercitation ullamco.</p> THE CSS: .special_styles { text-align:right; color: green; font-style: italic; }
  • 10. THE RESULT Lorem ipsum dolor sit amet, consectetur adipisicing elit Sed do eiusmod tempor incididunt ut labore et dolore. Magna aliqua. Ut enim ad minim veniam. Quis nostrud exercitation ullamco. .special_styles { text-align:right; color: green; font-style: italic; }
  • 11. LET'S DEVELOP IT Organize your web page into 4 parts using <div>'s: header — footer — sidebar — content Give each new div an id with the name that corresponds to its part. hint: sidebars are a good place for lists. hint: for a footer, add a "copyright" with your name and the year to the bottom of your page.
  • 13.
  • 14. PADDING: The space between the border and the content Makes the box "wider" (adds to the total width.)
  • 15.
  • 16. PADDING To make the padding on all sides the same, use the "padding" property and one value padding: 15px; Or you can style the sides individually padding-top: 10px; padding-bottom: 20px; padding-left: 25px; padding-right: 8px;
  • 17. PADDING SHORTHAND You can also use shorthand to style the sides in one declaration padding: 10px 5px 3px 5px; is the same as: padding-top: 10px; padding-right: 5px; padding-bottom: 3px; padding-left: 5px; The order is: top right bottom left
  • 18. PADDING SHORTHAND If the top and bottom padding are the same, and the left and right are the same, you can use two values: padding: 30px 50px; is the same as: padding-top: 30px; padding-right: 50px; padding-bottom: 30px; padding-left: 50px; The order is: top/bottom right/left
  • 19. BORDER: Between padding and margin. border-width — border-style — border-color
  • 20.
  • 22. BORDER STYLE SHORTHAND You can specify each property separately, or all three together. EXAMPLE: A solid red border: border: 1px solid #ff0000;
  • 23. BORDER STYLE SHORTHAND You can specify separate styles for the top, left, right or bottom border EXAMPLES: A thick dotted black top border: border-top: 4px dotted #000000; Two different border styles: border-top: 1px solid #ff0000; border-bottom: 4px dotted #000000;
  • 24. MARGIN The transparent area around the box that separates it from other elements.
  • 25.
  • 26. MARGINS Styled just like padding! margin: 15px; Or you can style the sides individually margin-top: 10px; margin-bottom: 20px; margin-left: 25px; margin-right: 8px;
  • 27. MARGIN SHORTHAND Same as padding! margin: 10px 5px 3px 5px; is the same as: margin-top: 10px; margin-right: 5px; margin-bottom: 3px; margin-left: 5px; The order is: top right bottom left
  • 28. MARGIN SHORTHAND Like padding, if the top and bottom margin are the same, and the left and right are the same, you can use two values: margin: 30px 50px; is the same as: margin-top: 30px; margin-right: 50px; margin-bottom: 30px; margin-left: 50px; The order is: top/bottom right/left
  • 29. AUTO MARGIN If a margin is set to auto on a box that has width, it will take up as much space as possible. This will "center" the box: margin: auto; width: 300px; This will put the box on the right: margin-left: auto; margin-right: 5px; width: 300px;
  • 30. WIDTH AND HEIGHT width: 600px; Sets the width of an element to 600px. height: 300px; Sets the height of an element to 300px. These only refer to the content area. Padding and border will add to the height and/or width.
  • 31. LET'S TAKE A LOOK AT A DEMO! of padding, borders, margins, widths and heights.