SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Copyright © Terry Felke-Morris
WEB DEVELOPMENT & DESIGN
FOUNDATIONS WITH HTML5
Chapter 6
Key Concepts
1Copyright © Terry Felke-Morris
Copyright © Terry Felke-Morris
LEARNING OUTCOMES
In this chapter, you will learn how to ...
ď‚„ Describe and apply the CSS Box Model
ď‚„ Configure margin with CSS
ď‚„ Configure float with CSS
ď‚„ Configure relative and absolute positioning with CSS
ď‚„ Create two-column page layouts using CSS
ď‚„ Configure navigation in unordered lists and style with CSS
ď‚„ Add interactivity to hyperlinks with CSS pseudo-classes
ď‚„ Configure web pages with HTML5 structural elements,
including section, header, hgroup, nav, aside, and footer
2
Copyright © Terry Felke-Morris
THE BOX MODEL
ď‚„ Content
ď‚„ Text & web page
elements in the
container
ď‚„ Padding
ď‚„ Area between the
content and the border
ď‚„ Border
ď‚„ Between the padding
and the margin
ď‚„ Margin
ď‚„ Determines the empty
space between the
element and adjacent
elements
3
Copyright © Terry Felke-Morris
CONFIGURE MARGIN WITH CSS
ď‚„ The margin property
ď‚„ Related properties:
ď‚„ margin-top, margin-right, margin-left, margin-bottom
ď‚„ Configures empty space between the element and adjacent
elements
ď‚„ Syntax examples
h1 { margin: 0; }
h1 { margin: 20px 10px; }
h1 { margin: 10px 30px 20px; }
h1 { margin: 20px 30px 0 30px; }
Copyright © Terry Felke-Morris
CONFIGURE PADDING WITH CSS
ď‚„ The padding property
ď‚„ Related properties:
ď‚„ padding-top, padding-right, padding-left,
padding-bottom
ď‚„ Configures empty space between the content of the HTML
element (such as text) and the border
ď‚„ Syntax examples
h1 { padding: 0; }
h1 { padding : 20px 10px; }
h1 { padding : 10px 30px 20px; }
h1 { padding : 20px 30px 0 30px; }
Copyright © Terry Felke-Morris
BOX MODEL IN ACTION
6
Copyright © Terry Felke-Morris
NORMAL FLOW
ď‚„ Browser display of elements in the order they are
coded in the Web page document
Copyright © Terry Felke-Morris
RELATIVE POSITIONING
Changes the location of
an element in relation to
where it would otherwise
appear
8
h1 { background-color:#cccccc;
padding: 5px;
color: #000000; }
#myContent { position: relative;
left: 30px;
font-family: Arial,sans-serif; }
h1 { background-color:#cccccc;
padding: 5px;
color: #000000; }
#myContent { position: relative;
left: 30px;
font-family: Arial,sans-serif; }
Copyright © Terry Felke-Morris
ABSOLUTE POSITIONING
Precisely specifies the location of an
element in the browser window
h1 { background-color: #cccccc;
padding: 5px;
color: #000000; }
#content {position: absolute;
left: 200;
top: 100;
font-family: Arial,sans-serif;
width: 300; }
h1 { background-color: #cccccc;
padding: 5px;
color: #000000; }
#content {position: absolute;
left: 200;
top: 100;
font-family: Arial,sans-serif;
width: 300; }
9
Copyright © Terry Felke-Morris
ABSOLUTE POSITIONING EXAMPLE
Copyright © Terry Felke-Morris
h1 { background-color:#cccccc;
padding:5px;
color: #000000;
}
p { font-family:Arial,sans-serif;
}
#yls {float:right;
margin: 0 0 5px 5px;
border: solid;
}
FLOAT PROPERTY
ď‚„ Elements that seem to
“float" on the right or
left side of either the
browser window or
another element are
often configured using
the float property.
11
Copyright © Terry Felke-Morris
CLEAR PROPERTY
 Useful to “clear” or
terminate a float
ď‚„ Values are left, right, and
both
The h2 text
is displayed
in normal
flow.
The h2 text
is displayed
in normal
flow.
clear: left; was
applied to the h2.
Now the h2 text
displays AFTER the
floated image.
clear: left; was
applied to the h2.
Now the h2 text
displays AFTER the
floated image.
Copyright © Terry Felke-Morris
OVERFLOW PROPERTY
ď‚„ Intended to configure the
display of elements on a Web
page.
 However, it is useful to “clear”
or terminate a float before the
end of a container element
ď‚„ Values are auto, hidden, and
scroll
The
background
does not
extend as far
as you’d
expect.
The
background
does not
extend as far
as you’d
expect.
overflow: auto;
was applied to the div
that contains the image
and paragraph. Now the
background extends and
the h2 text displays
AFTER the floated image.
overflow: auto;
was applied to the div
that contains the image
and paragraph. Now the
background extends and
the h2 text displays
AFTER the floated image.
Copyright © Terry Felke-Morris
CHECKPOINT
1. List the components of the box model
from innermost to outermost.
2. Describe the difference between
relative and absolute positioning.
3. Describe the purpose of the CSS float
property.
14
Copyright © Terry Felke-Morris
DISPLAY PROPERTY
ď‚„ Configures how and if an element is displayed
ď‚„ display: none;
ď‚„ The element will not be displayed.
ď‚„ display: block;
 The element is rendered as a block element – even if it is actually
an inline element, such as a hyperlink.
ď‚„ display: inline;
 The element will be rendered as an inline element – even if it is
actually a block element – such as a <li>.
 You’ll work with the display property later in the chapter.
15
Copyright © Terry Felke-Morris
CSS PAGE LAYOUT
TWO COLUMNS (LEFT NAV)
Copyright © Terry Felke-Morris
CSS PAGE LAYOUT
TWO COLUMNS (TOP LOGO, LEFT NAV)
Copyright © Terry Felke-Morris
CONFIGURE
HYPERLINKS IN
AN UNORDERED LIST
ď‚„ Vertical Navigation
<div id="leftcolumn">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="menu.html">Menu</a></li>
<li><a href="directions.html">Directions</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
ď‚„ CSS removes the list marker and underline:
#leftcolumn ul { list-style-type: none; }
#leftcolumn a { text-decoration: none; }
18
Copyright © Terry Felke-Morris
CONFIGURE
HYPERLINKS IN
AN UNORDERED LIST
ď‚„ Horizontal Navigation
HTML:
<div id="nav">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="menu.html">Menu</a></li>
<li><a href="directions.html">Directions</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
ď‚„ CSS removes the list marker, removes the underline, adds padding, and
configures the list items for inline display.
#nav ul { list-style-type: none;}
#nav a { text-decoration: none;
padding-right: 10px; }
#nav li { display: inline; }
19
Copyright © Terry Felke-Morris
CSS PSEUDO-CLASSES
ď‚—Pseudo-classes and the anchor element
◦ link – default state
for a hyperlink
◦ visited –a hyperlink that
has been visited
◦ focus – triggered when
the hyperlink has focus
◦ hover – triggered when
the mouse moves over the hyperlink
◦ active – triggered when the hyperlink is being clicked
a:link {color:#000066;}
a:visited {color:#003366;}
a:focus {color:#FF0000;}
a:hover {color:#0099CC;}
a:active {color:#FF0000;}
a:link {color:#000066;}
a:visited {color:#003366;}
a:focus {color:#FF0000;}
a:hover {color:#0099CC;}
a:active {color:#FF0000;}
Copyright © Terry Felke-Morris
CSS
PSEUDO-CLASSES
a:link { color: #ff0000; }
a:hover { text-decoration: none;
color: #000066; }
21
Copyright © Terry Felke-Morris
DECIDING TO CONFIGURE A CLASS OR ID
ď‚„ Configure a class:
ď‚„ If the style may apply to more than one element on a page
ď‚„ Use the . (dot) notation in the style sheet.
ď‚„ Use the class attribute in the HTML.
ď‚„ Configure an id:
ď‚„ If the style is specific to only one element on a page
ď‚„ Use the # notation in the style sheet.
ď‚„ Use the id attribute in the HTML.
22
Copyright © Terry Felke-Morris
CHOOSING A NAME FOR A CLASS OR AN ID
ď‚—A class or id name should be descriptive of the
purpose:
â—¦ such as nav, news, footer, etc.
â—¦ Bad choice for a name: redText, bolded, blueborder, etc.
ď‚—The the 10 most commonly used class names are:
footer, menu, title, small, text, content,
header, nav, copyright, and button
ď‚—Source: http://code.google.com/webstats
23
Copyright © Terry Felke-Morris
CSS DEBUGGING TIPS
ď‚„ Manually check syntax errors
ď‚„ Use W3C CSSValidator to check syntax errors
ď‚„ http://jigsaw.w3.org/css-validator/
ď‚„ Configure temporary background colors
ď‚„ Configure temporary borders
ď‚„ Use CSS comments to find the unexpected
/* the browser ignores this code */
 Don’t expect your pages to look exactly the same in all
browsers!
ď‚„ Be patient!
24
Copyright © Terry Felke-Morris
CHECKPOINT
1. Open the chapter6/practice/index.html file from Hands-On Practice
6.5 in a browser. Resize the browser window. Describe what happens.
What type of page design layout (ice, jello, or liquid) is being used?
2. Describe one CSS debugging tip that you have found helpful.
3. Describe how to choose whether to configure an HTML element
selector, create a class, or create an id when working with CSS.
25
Copyright © Terry Felke-Morris
HTML5 STRUCTURAL ELEMENTS
ď‚„ Header Element
ď‚„ contains the headings of either a web page
document or an area in the document such as a
section or article.
ď‚„ Hgroup Element
ď‚„ contains two or more heading elements (h1, h2, and
so on)
26
Copyright © Terry Felke-Morris
HTML5 STRUCTURAL ELEMENTS
ď‚„ Header Element
ď‚„ Hgroup Element
Example:
<header>
<hgroup>
<h1>Lighthouse&nbsp;Island&nbsp;Bistro</h1>
<h2>the best coffee on the coast</h2>
</hgroup>
</header>
27
Copyright © Terry Felke-Morris
MORE HTML5 ELEMENTS
ď‚„ Nav Element
ď‚„ contains a section of navigation hyperlinks
ď‚„ block display
ď‚„ Footer Element
ď‚„ contains the footer content of a web page or specific area (such as a
section or article) on a web page
ď‚„ block display
ď‚„ Aside Element
ď‚„ contains a sidebar, a note, or other tangential content
ď‚„ block display
28
Copyright © Terry Felke-Morris
MORE HTML5 ELEMENTS
ď‚„ Section Element
 contains a “section” of a document, such as a chapter or topic
ď‚„ block display
ď‚„ Article Element
ď‚„ contains an independent entry, such as a blog posting, comment, or e-
zine article that could stand on its own
ď‚„ block display
ď‚„ Time Element
ď‚„ represents a date or a time
ď‚„ could be useful to date articles or blog posts
ď‚„ inline display
29
Copyright © Terry Felke-Morris
CHECKPOINT
1. Describe a reason to use HTML5 structural elements instead of div
elements for some page areas.
2. Describe the purpose of the article element.
3. Describe the purpose of the hgroup element.
30
Copyright © Terry Felke-Morris
SUMMARY
ď‚„ This chapter introduced you to the
box model, CSS pseudo-classes,
configuring two-column page layouts
with CSS, and HTML5 structural
elements.
31

Weitere ähnliche Inhalte

Was ist angesagt?

Chapter 10 - Web Design
Chapter 10 - Web DesignChapter 10 - Web Design
Chapter 10 - Web Designtclanton4
 
Chapter 1 - Web Design
Chapter 1 - Web DesignChapter 1 - Web Design
Chapter 1 - Web Designtclanton4
 
WordPress HTML, CSS & Child Themes
WordPress HTML, CSS & Child ThemesWordPress HTML, CSS & Child Themes
WordPress HTML, CSS & Child ThemesMichelle Ames
 
How websites and search engines work
How websites and search engines workHow websites and search engines work
How websites and search engines workBrian Duffy
 
Creating WordPress Sites in 2 Hours
Creating WordPress Sites in 2 HoursCreating WordPress Sites in 2 Hours
Creating WordPress Sites in 2 HoursSvetlin Nakov
 
Intro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterIntro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterbrightrocket
 
Building a Simple, Responsive Website with ExpressionEngine
Building a Simple, Responsive Website with ExpressionEngineBuilding a Simple, Responsive Website with ExpressionEngine
Building a Simple, Responsive Website with ExpressionEngineOttergoose
 
Introduction to web design
Introduction to web designIntroduction to web design
Introduction to web designUmamaheshwariv1
 
Introduction to-concrete-5
Introduction to-concrete-5Introduction to-concrete-5
Introduction to-concrete-5ketanraval
 
Introduction to-concrete-5
Introduction to-concrete-5Introduction to-concrete-5
Introduction to-concrete-5Ketan Raval
 
Introduction to web design
Introduction to web designIntroduction to web design
Introduction to web designSumit Tambe
 
Introduction to web design
Introduction to web designIntroduction to web design
Introduction to web designakhileshraj23
 
Internet Librarian Slides
Internet Librarian SlidesInternet Librarian Slides
Internet Librarian SlidesPolly Farrington
 
World wide web with multimedia
World wide web with multimediaWorld wide web with multimedia
World wide web with multimediaAfaq Siddiqui
 
Website development accessibility
Website development accessibilityWebsite development accessibility
Website development accessibilityIlesh Mistry
 
Macromedia Dreamweaver 8
Macromedia Dreamweaver 8Macromedia Dreamweaver 8
Macromedia Dreamweaver 8Jeff Wood
 
Html 4.0
Html 4.0Html 4.0
Html 4.0waynet20
 

Was ist angesagt? (20)

Chapter5
Chapter5Chapter5
Chapter5
 
Chapter 10 - Web Design
Chapter 10 - Web DesignChapter 10 - Web Design
Chapter 10 - Web Design
 
Chapter 1 - Web Design
Chapter 1 - Web DesignChapter 1 - Web Design
Chapter 1 - Web Design
 
WordPress HTML, CSS & Child Themes
WordPress HTML, CSS & Child ThemesWordPress HTML, CSS & Child Themes
WordPress HTML, CSS & Child Themes
 
How websites and search engines work
How websites and search engines workHow websites and search engines work
How websites and search engines work
 
Creating WordPress Sites in 2 Hours
Creating WordPress Sites in 2 HoursCreating WordPress Sites in 2 Hours
Creating WordPress Sites in 2 Hours
 
Intro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterIntro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniter
 
Building a Simple, Responsive Website with ExpressionEngine
Building a Simple, Responsive Website with ExpressionEngineBuilding a Simple, Responsive Website with ExpressionEngine
Building a Simple, Responsive Website with ExpressionEngine
 
Introduction to web design
Introduction to web designIntroduction to web design
Introduction to web design
 
Introduction to-concrete-5
Introduction to-concrete-5Introduction to-concrete-5
Introduction to-concrete-5
 
Introduction to-concrete-5
Introduction to-concrete-5Introduction to-concrete-5
Introduction to-concrete-5
 
Introduction to web design
Introduction to web designIntroduction to web design
Introduction to web design
 
Introduction to web design
Introduction to web designIntroduction to web design
Introduction to web design
 
Introduction to web design
Introduction to web designIntroduction to web design
Introduction to web design
 
Internet Librarian Slides
Internet Librarian SlidesInternet Librarian Slides
Internet Librarian Slides
 
World wide web with multimedia
World wide web with multimediaWorld wide web with multimedia
World wide web with multimedia
 
Wordpress(css,php,js,ajax)
Wordpress(css,php,js,ajax)Wordpress(css,php,js,ajax)
Wordpress(css,php,js,ajax)
 
Website development accessibility
Website development accessibilityWebsite development accessibility
Website development accessibility
 
Macromedia Dreamweaver 8
Macromedia Dreamweaver 8Macromedia Dreamweaver 8
Macromedia Dreamweaver 8
 
Html 4.0
Html 4.0Html 4.0
Html 4.0
 

Ă„hnlich wie Chapter 6 - Web Design

Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basicsEliran Eliassy
 
Web Development 4
Web Development 4Web Development 4
Web Development 4ghayour abbas
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)ghayour abbas
 
Rapid HTML Prototyping with Bootstrap 4
Rapid HTML Prototyping with Bootstrap 4Rapid HTML Prototyping with Bootstrap 4
Rapid HTML Prototyping with Bootstrap 4UXPA International
 
Web Typography
Web TypographyWeb Typography
Web TypographyShawn Calvert
 
Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.netProgrammer Blog
 
HTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchorsHTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchorsGrayzon Gonzales, LPT
 
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 1Heather Rock
 
BYOWHC823
BYOWHC823BYOWHC823
BYOWHC823Thinkful
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship CourseZoltan Iszlai
 
Css tutorial
Css tutorialCss tutorial
Css tutorialvedaste
 

Ă„hnlich wie Chapter 6 - Web Design (20)

Chapter6
Chapter6Chapter6
Chapter6
 
Chapter7
Chapter7Chapter7
Chapter7
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Web Development 4
Web Development 4Web Development 4
Web Development 4
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
 
Rapid HTML Prototyping with Bootstrap 4
Rapid HTML Prototyping with Bootstrap 4Rapid HTML Prototyping with Bootstrap 4
Rapid HTML Prototyping with Bootstrap 4
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Chapter4
Chapter4Chapter4
Chapter4
 
Web Typography
Web TypographyWeb Typography
Web Typography
 
Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.net
 
HTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchorsHTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchors
 
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
 
Html5
Html5Html5
Html5
 
Html5 ux london
Html5 ux londonHtml5 ux london
Html5 ux london
 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
 
BYOWHC823
BYOWHC823BYOWHC823
BYOWHC823
 
CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
 

Mehr von tclanton4

Chapter 12 - Web Design
Chapter 12 - Web DesignChapter 12 - Web Design
Chapter 12 - Web Designtclanton4
 
Chapter 9 - Web Design
Chapter 9 - Web DesignChapter 9 - Web Design
Chapter 9 - Web Designtclanton4
 
Chapter 8 - Web Design
Chapter 8 - Web DesignChapter 8 - Web Design
Chapter 8 - Web Designtclanton4
 
Impress
ImpressImpress
Impresstclanton4
 
Project Mgt
Project MgtProject Mgt
Project Mgttclanton4
 
Charts in Calc
Charts in CalcCharts in Calc
Charts in Calctclanton4
 
Formatting a Worksheet in Calc
Formatting a Worksheet in CalcFormatting a Worksheet in Calc
Formatting a Worksheet in Calctclanton4
 
Creating a Worksheet in Calc
Creating a Worksheet in CalcCreating a Worksheet in Calc
Creating a Worksheet in Calctclanton4
 
Advanced Features of Writer
Advanced Features of WriterAdvanced Features of Writer
Advanced Features of Writertclanton4
 
Creating a Writer Document
Creating a Writer DocumentCreating a Writer Document
Creating a Writer Documenttclanton4
 
Formatting Features of Writer
Formatting Features of WriterFormatting Features of Writer
Formatting Features of Writertclanton4
 
Getting Started - The Basics
Getting Started - The BasicsGetting Started - The Basics
Getting Started - The Basicstclanton4
 
Intro to Information Systems
Intro to Information SystemsIntro to Information Systems
Intro to Information Systemstclanton4
 
Unit 04 PowerPoint (WebA)
Unit 04 PowerPoint (WebA)Unit 04 PowerPoint (WebA)
Unit 04 PowerPoint (WebA)tclanton4
 

Mehr von tclanton4 (16)

Chapter 12 - Web Design
Chapter 12 - Web DesignChapter 12 - Web Design
Chapter 12 - Web Design
 
Chapter 9 - Web Design
Chapter 9 - Web DesignChapter 9 - Web Design
Chapter 9 - Web Design
 
Chapter 8 - Web Design
Chapter 8 - Web DesignChapter 8 - Web Design
Chapter 8 - Web Design
 
Base2
Base2Base2
Base2
 
Base1
Base1Base1
Base1
 
Impress
ImpressImpress
Impress
 
Project Mgt
Project MgtProject Mgt
Project Mgt
 
Charts in Calc
Charts in CalcCharts in Calc
Charts in Calc
 
Formatting a Worksheet in Calc
Formatting a Worksheet in CalcFormatting a Worksheet in Calc
Formatting a Worksheet in Calc
 
Creating a Worksheet in Calc
Creating a Worksheet in CalcCreating a Worksheet in Calc
Creating a Worksheet in Calc
 
Advanced Features of Writer
Advanced Features of WriterAdvanced Features of Writer
Advanced Features of Writer
 
Creating a Writer Document
Creating a Writer DocumentCreating a Writer Document
Creating a Writer Document
 
Formatting Features of Writer
Formatting Features of WriterFormatting Features of Writer
Formatting Features of Writer
 
Getting Started - The Basics
Getting Started - The BasicsGetting Started - The Basics
Getting Started - The Basics
 
Intro to Information Systems
Intro to Information SystemsIntro to Information Systems
Intro to Information Systems
 
Unit 04 PowerPoint (WebA)
Unit 04 PowerPoint (WebA)Unit 04 PowerPoint (WebA)
Unit 04 PowerPoint (WebA)
 

KĂĽrzlich hochgeladen

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 

KĂĽrzlich hochgeladen (20)

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 

Chapter 6 - Web Design

  • 1. Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1Copyright © Terry Felke-Morris
  • 2. Copyright © Terry Felke-Morris LEARNING OUTCOMES In this chapter, you will learn how to ... ď‚„ Describe and apply the CSS Box Model ď‚„ Configure margin with CSS ď‚„ Configure float with CSS ď‚„ Configure relative and absolute positioning with CSS ď‚„ Create two-column page layouts using CSS ď‚„ Configure navigation in unordered lists and style with CSS ď‚„ Add interactivity to hyperlinks with CSS pseudo-classes ď‚„ Configure web pages with HTML5 structural elements, including section, header, hgroup, nav, aside, and footer 2
  • 3. Copyright © Terry Felke-Morris THE BOX MODEL ď‚„ Content ď‚„ Text & web page elements in the container ď‚„ Padding ď‚„ Area between the content and the border ď‚„ Border ď‚„ Between the padding and the margin ď‚„ Margin ď‚„ Determines the empty space between the element and adjacent elements 3
  • 4. Copyright © Terry Felke-Morris CONFIGURE MARGIN WITH CSS ď‚„ The margin property ď‚„ Related properties: ď‚„ margin-top, margin-right, margin-left, margin-bottom ď‚„ Configures empty space between the element and adjacent elements ď‚„ Syntax examples h1 { margin: 0; } h1 { margin: 20px 10px; } h1 { margin: 10px 30px 20px; } h1 { margin: 20px 30px 0 30px; }
  • 5. Copyright © Terry Felke-Morris CONFIGURE PADDING WITH CSS ď‚„ The padding property ď‚„ Related properties: ď‚„ padding-top, padding-right, padding-left, padding-bottom ď‚„ Configures empty space between the content of the HTML element (such as text) and the border ď‚„ Syntax examples h1 { padding: 0; } h1 { padding : 20px 10px; } h1 { padding : 10px 30px 20px; } h1 { padding : 20px 30px 0 30px; }
  • 6. Copyright © Terry Felke-Morris BOX MODEL IN ACTION 6
  • 7. Copyright © Terry Felke-Morris NORMAL FLOW ď‚„ Browser display of elements in the order they are coded in the Web page document
  • 8. Copyright © Terry Felke-Morris RELATIVE POSITIONING Changes the location of an element in relation to where it would otherwise appear 8 h1 { background-color:#cccccc; padding: 5px; color: #000000; } #myContent { position: relative; left: 30px; font-family: Arial,sans-serif; } h1 { background-color:#cccccc; padding: 5px; color: #000000; } #myContent { position: relative; left: 30px; font-family: Arial,sans-serif; }
  • 9. Copyright © Terry Felke-Morris ABSOLUTE POSITIONING Precisely specifies the location of an element in the browser window h1 { background-color: #cccccc; padding: 5px; color: #000000; } #content {position: absolute; left: 200; top: 100; font-family: Arial,sans-serif; width: 300; } h1 { background-color: #cccccc; padding: 5px; color: #000000; } #content {position: absolute; left: 200; top: 100; font-family: Arial,sans-serif; width: 300; } 9
  • 10. Copyright © Terry Felke-Morris ABSOLUTE POSITIONING EXAMPLE
  • 11. Copyright © Terry Felke-Morris h1 { background-color:#cccccc; padding:5px; color: #000000; } p { font-family:Arial,sans-serif; } #yls {float:right; margin: 0 0 5px 5px; border: solid; } FLOAT PROPERTY ď‚„ Elements that seem to “float" on the right or left side of either the browser window or another element are often configured using the float property. 11
  • 12. Copyright © Terry Felke-Morris CLEAR PROPERTY ď‚„ Useful to “clear” or terminate a float ď‚„ Values are left, right, and both The h2 text is displayed in normal flow. The h2 text is displayed in normal flow. clear: left; was applied to the h2. Now the h2 text displays AFTER the floated image. clear: left; was applied to the h2. Now the h2 text displays AFTER the floated image.
  • 13. Copyright © Terry Felke-Morris OVERFLOW PROPERTY ď‚„ Intended to configure the display of elements on a Web page. ď‚„ However, it is useful to “clear” or terminate a float before the end of a container element ď‚„ Values are auto, hidden, and scroll The background does not extend as far as you’d expect. The background does not extend as far as you’d expect. overflow: auto; was applied to the div that contains the image and paragraph. Now the background extends and the h2 text displays AFTER the floated image. overflow: auto; was applied to the div that contains the image and paragraph. Now the background extends and the h2 text displays AFTER the floated image.
  • 14. Copyright © Terry Felke-Morris CHECKPOINT 1. List the components of the box model from innermost to outermost. 2. Describe the difference between relative and absolute positioning. 3. Describe the purpose of the CSS float property. 14
  • 15. Copyright © Terry Felke-Morris DISPLAY PROPERTY ď‚„ Configures how and if an element is displayed ď‚„ display: none; ď‚„ The element will not be displayed. ď‚„ display: block; ď‚„ The element is rendered as a block element – even if it is actually an inline element, such as a hyperlink. ď‚„ display: inline; ď‚„ The element will be rendered as an inline element – even if it is actually a block element – such as a <li>. ď‚„ You’ll work with the display property later in the chapter. 15
  • 16. Copyright © Terry Felke-Morris CSS PAGE LAYOUT TWO COLUMNS (LEFT NAV)
  • 17. Copyright © Terry Felke-Morris CSS PAGE LAYOUT TWO COLUMNS (TOP LOGO, LEFT NAV)
  • 18. Copyright © Terry Felke-Morris CONFIGURE HYPERLINKS IN AN UNORDERED LIST ď‚„ Vertical Navigation <div id="leftcolumn"> <ul> <li><a href="index.html">Home</a></li> <li><a href="menu.html">Menu</a></li> <li><a href="directions.html">Directions</a></li> <li><a href="contact.html">Contact</a></li> </ul> </div> ď‚„ CSS removes the list marker and underline: #leftcolumn ul { list-style-type: none; } #leftcolumn a { text-decoration: none; } 18
  • 19. Copyright © Terry Felke-Morris CONFIGURE HYPERLINKS IN AN UNORDERED LIST ď‚„ Horizontal Navigation HTML: <div id="nav"> <ul> <li><a href="index.html">Home</a></li> <li><a href="menu.html">Menu</a></li> <li><a href="directions.html">Directions</a></li> <li><a href="contact.html">Contact</a></li> </ul> </div> ď‚„ CSS removes the list marker, removes the underline, adds padding, and configures the list items for inline display. #nav ul { list-style-type: none;} #nav a { text-decoration: none; padding-right: 10px; } #nav li { display: inline; } 19
  • 20. Copyright © Terry Felke-Morris CSS PSEUDO-CLASSES ď‚—Pseudo-classes and the anchor element â—¦ link – default state for a hyperlink â—¦ visited –a hyperlink that has been visited â—¦ focus – triggered when the hyperlink has focus â—¦ hover – triggered when the mouse moves over the hyperlink â—¦ active – triggered when the hyperlink is being clicked a:link {color:#000066;} a:visited {color:#003366;} a:focus {color:#FF0000;} a:hover {color:#0099CC;} a:active {color:#FF0000;} a:link {color:#000066;} a:visited {color:#003366;} a:focus {color:#FF0000;} a:hover {color:#0099CC;} a:active {color:#FF0000;}
  • 21. Copyright © Terry Felke-Morris CSS PSEUDO-CLASSES a:link { color: #ff0000; } a:hover { text-decoration: none; color: #000066; } 21
  • 22. Copyright © Terry Felke-Morris DECIDING TO CONFIGURE A CLASS OR ID ď‚„ Configure a class: ď‚„ If the style may apply to more than one element on a page ď‚„ Use the . (dot) notation in the style sheet. ď‚„ Use the class attribute in the HTML. ď‚„ Configure an id: ď‚„ If the style is specific to only one element on a page ď‚„ Use the # notation in the style sheet. ď‚„ Use the id attribute in the HTML. 22
  • 23. Copyright © Terry Felke-Morris CHOOSING A NAME FOR A CLASS OR AN ID ď‚—A class or id name should be descriptive of the purpose: â—¦ such as nav, news, footer, etc. â—¦ Bad choice for a name: redText, bolded, blueborder, etc. ď‚—The the 10 most commonly used class names are: footer, menu, title, small, text, content, header, nav, copyright, and button ď‚—Source: http://code.google.com/webstats 23
  • 24. Copyright © Terry Felke-Morris CSS DEBUGGING TIPS ď‚„ Manually check syntax errors ď‚„ Use W3C CSSValidator to check syntax errors ď‚„ http://jigsaw.w3.org/css-validator/ ď‚„ Configure temporary background colors ď‚„ Configure temporary borders ď‚„ Use CSS comments to find the unexpected /* the browser ignores this code */ ď‚„ Don’t expect your pages to look exactly the same in all browsers! ď‚„ Be patient! 24
  • 25. Copyright © Terry Felke-Morris CHECKPOINT 1. Open the chapter6/practice/index.html file from Hands-On Practice 6.5 in a browser. Resize the browser window. Describe what happens. What type of page design layout (ice, jello, or liquid) is being used? 2. Describe one CSS debugging tip that you have found helpful. 3. Describe how to choose whether to configure an HTML element selector, create a class, or create an id when working with CSS. 25
  • 26. Copyright © Terry Felke-Morris HTML5 STRUCTURAL ELEMENTS ď‚„ Header Element ď‚„ contains the headings of either a web page document or an area in the document such as a section or article. ď‚„ Hgroup Element ď‚„ contains two or more heading elements (h1, h2, and so on) 26
  • 27. Copyright © Terry Felke-Morris HTML5 STRUCTURAL ELEMENTS ď‚„ Header Element ď‚„ Hgroup Element Example: <header> <hgroup> <h1>Lighthouse&nbsp;Island&nbsp;Bistro</h1> <h2>the best coffee on the coast</h2> </hgroup> </header> 27
  • 28. Copyright © Terry Felke-Morris MORE HTML5 ELEMENTS ď‚„ Nav Element ď‚„ contains a section of navigation hyperlinks ď‚„ block display ď‚„ Footer Element ď‚„ contains the footer content of a web page or specific area (such as a section or article) on a web page ď‚„ block display ď‚„ Aside Element ď‚„ contains a sidebar, a note, or other tangential content ď‚„ block display 28
  • 29. Copyright © Terry Felke-Morris MORE HTML5 ELEMENTS ď‚„ Section Element ď‚„ contains a “section” of a document, such as a chapter or topic ď‚„ block display ď‚„ Article Element ď‚„ contains an independent entry, such as a blog posting, comment, or e- zine article that could stand on its own ď‚„ block display ď‚„ Time Element ď‚„ represents a date or a time ď‚„ could be useful to date articles or blog posts ď‚„ inline display 29
  • 30. Copyright © Terry Felke-Morris CHECKPOINT 1. Describe a reason to use HTML5 structural elements instead of div elements for some page areas. 2. Describe the purpose of the article element. 3. Describe the purpose of the hgroup element. 30
  • 31. Copyright © Terry Felke-Morris SUMMARY ď‚„ This chapter introduced you to the box model, CSS pseudo-classes, configuring two-column page layouts with CSS, and HTML5 structural elements. 31