SlideShare a Scribd company logo
1 of 31
Copyright © Terry Felke-Morris http://terrymorris.net
Web Development & Design
Foundations with HTML5
8th
Edition
CHAPTER 7
KEY CONCEPTS
1
Copyright © Terry Felke-Morris
Copyright © Terry Felke-Morris http://terrymorris.net
Learning
Outcomes
In this chapter, you will learn how to ...
•Code relative hyperlinks to web pages in folders within a website
•Configure a hyperlink to a named fragment internal to a web page
•Provide for accessibility by configuring ARIA landmark roles for structural HTML
elements
•Configure images with CSS sprites
•Configure a three-column page layout using CSS
•Configure CSS for printing
•Describe mobile design best practices
•Configure web pages for mobile display using the viewport meta tag
•Apply responsive web design techniques with CSS3 media queries and flexible images
2
Copyright © Terry Felke-Morris http://terrymorris.net
More on
Relative Linking
<a href="contact.html">Contact</a>
<a href="rooms/canyon.html">Canyon</a>
<a href="../index.html">Home</a>
<a href="../events/weekend.html">Weekend</a>
3
Relative links from the Home page:
index.html
Relative links from the Canyon page:
rooms/canyon.html
Copyright © Terry Felke-Morris http://terrymorris.net
HTML Linking to Fragment
Identifiers
A link to a part of a web page
Also called named fragments, fragment ids
Two components:
1. The element that identifies the named fragment of a
web page. This requires the id attribute.
<div id=“top”> ….. </div>
2. The anchor tag that links to the named fragment of a
web page. This uses the href attribute.
<a href=“#top”>Back to Top</a>
4
Note the use of the # in the anchor tag!
Copyright © Terry Felke-Morris http://terrymorris.net
Landmark Roles with ARIA
Accessible Rich Internet Applications (ARIA)
Landmark Roles
◦banner (a header/logo area)
◦navigation (a collection of navigation elements)
◦main (the main content of a document)
◦complementary (a supporting part of the web page document,
designed to be complementary to the main content )
◦contentinfo (an area that contains information about the content such
as copyright )
◦form (an area that contains a form)
◦search (an area of a web page that provides search functionality)
5
Example: <header role=“banner”>
Copyright © Terry Felke-Morris http://terrymorris.net
Opening a Link
in a New Browser Window
The target attribute on the anchor element opens a
link in a new browser window or new browser tab.
<a href="http://yahoo.com" target="_blank">Yahoo!</a>
6
Copyright © Terry Felke-Morris http://terrymorris.net
HTML5 Block Anchor
Configure block display elements within a hyperlink
<a href="http://www.w3.org/TR/html-markup">
<h1>HTML5 Reference</h1>
<p>Bookmark this site for a handy HTML5 reference.</p>
</a>
7
Copyright © Terry Felke-Morris http://terrymorris.net
Telephone & Text Message
Hyperlinks
Telephone Scheme
<a href="tel:888-555-5555">Call 888-555-5555</a>
Many mobile browsers will initiate a phone call when the hyperlink is
clicked.
SMS Scheme
<a href="sms:888-555-5555">Text 888-555-5555</a>
Many mobile browsers will initiate a text message to the phone number
when the hyperlink is clicked.
8
Copyright © Terry Felke-Morris http://terrymorris.net
CSS Sprites
Sprite
◦an image file that contains multiple small graphics
◦advantage: saves download time
9
Copyright © Terry Felke-Morris http://terrymorris.net
Checkpoint
1. Describe a reason to organize the files in a website using
folders and subfolders.
2. Which attribute configures a hyperlink to open the file
in a new browser window or tab?
3. State an advantage of using CSS sprites in a website.
Copyright © Terry Felke-Morris http://terrymorris.net
Three Column
Page Layout
A common web page layout consists of a header across
the top of the page with three columns below:
navigation, content, and sidebar.
11
Copyright © Terry Felke-Morris http://terrymorris.net
Three Column
Layout
container sets default background
color, text color, font typeface, and a
minimum width
Left-column navigation
◦float: left; width:150px;
Right-column content
◦float: right; width: 200px;
Center column
◦Uses the remaining screen room available
room after the floating columns display
◦margin: 0 210px 0 160px;
Footer – clears the float
◦clear: both;
12
Copyright © Terry Felke-Morris http://terrymorris.net
CSS Styling for Print
Create an external style sheet with the configurations
for browser display.
Create a second external style sheet with the
configurations for printing.
Connect both of the external style sheets to the web
page using two <link > elements.
13
<link rel="stylesheet" href="wildflower.css" type="text/css" media="screen">
<link rel="stylesheet" href="wildflowerprint.css" type="text/css" media="print">
Copyright © Terry Felke-Morris http://terrymorris.net
Print Styling Best Practices
Hide non-essential content
Example:
#nav { display: none; }
Configure font size and color for printing
◦Use pt font sizes, use dark text color
Control page breaks
Example:
.newpage { page-break-before: always; }
Print URLs for hyperlinks
Example:
#sidebar a:after { content: " (" attr(href) ") "; }
14
Copyright © Terry Felke-Morris http://terrymorris.net
Mobile Web Limitations
Small Screen Size
Low bandwidth
Limited fonts
Limited color
Awkward controls
Lack of Flash support
Limited processor and memory
Cost per kilobyte
Copyright © Terry Felke-Morris http://terrymorris.net
Mobile Web Design Best
Practices
Recommended by the W3C
http://www.w3.org/TR/mobile-bp
http://www.w3.org/2007/02/mwbp_flip_cards.html
Optimize Layout, Navigation, Graphics,
and Text for Mobile Use
Design for One Web
Copyright © Terry Felke-Morris http://terrymorris.net
Optimize Layout for Mobile
Use
Single column design
Limit scrolling to one direction
Use heading elements
Use lists
Avoid using tables
Provide labels for form controls
Avoid using pixel units in style sheets
Avoid absolute positioning in style sheets
Hide content that is not essential for mobile use.
Copyright © Terry Felke-Morris http://terrymorris.net
Optimize Navigation for Mobile
Use
Provide minimal navigation
near the top of the page
Provide consistent navigation
Avoid hyperlinks that open files
in new windows or pop-up
windows
Try to balance both the number
of hyperlinks on a page and the
number of levels needed to
access information
Copyright © Terry Felke-Morris http://terrymorris.net
Optimize Graphics for Mobile
Use
Avoid displaying images that are
wider than the screen width
Configure alternate, small
optimized background images
Some mobile browsers will
downsize all images, so avoid using
images that contain text
Avoid the use of large graphic
images
Specify the size of images
Provide alternate text for graphics
and other non-text elements.
Copyright © Terry Felke-Morris http://terrymorris.net
Optimize Text for Mobile
Use
Configure good contrast
between text and background
colors
Use common font typefaces
Configure font size with em
units or percentages
Use a short, descriptive page
title
Copyright © Terry Felke-Morris http://terrymorris.net
Viewport Meta Tag
Default action for most mobile devices
is to zoom out and scale the web page
Viewport Meta Tag
Created as an Apple extension to configure
display on mobile devices
Configures width and initial scale of browser viewport
<meta name="viewport" content="width=device-width, initial-scale=1.0">
21
Copyright © Terry Felke-Morris http://terrymorris.net
CSS3 Media Queries
Media Query
◦Determines the capability of the mobile device,
such as screen resolution
◦Directs the browser to styles configured
specifically for those capabilities
Example with link tag
<link href="lighthousemobile.css" rel="stylesheet"
media="only all and (max-device-width: 480px)">
Example within CSS
@media only all and (max-width: 768px) {
}
22
Copyright © Terry Felke-Morris http://terrymorris.net
Flexible Images
Edit HTML:
remove height and width attributes
CSS:
img { max-width: 100%;
height: auto; }
23
Copyright © Terry Felke-Morris http://terrymorris.net
Responsive Images
HTML 5.1 Picture Element
<picture>
<source media="(min-width: 1200px)" srcset="large.jpg">
<source media="(min-width: 800px)" srcset="medium.jpg">
<source media="(min-width: 320px)" srcset="small.jpg">
<img src="fallback.jpg" alt="waterwheel">
</picture>
24
Copyright © Terry Felke-Morris http://terrymorris.net
Responsive Images
HTML 5.1 sizes & srcset
Attributes
<img src="fallback.jpg"
sizes="100vw"
srcset="large.jpg 1200w, medium.jpg 800w, small.jpg 320w"
alt="waterwheel">
25
Copyright © Terry Felke-Morris http://terrymorris.net
Testing Mobile Display
Options
•Test with a mobile device
•Emulators
• Opera Mobile Emulator
• Mobilizer
• iPhone Emulator
•Test with a Desktop Browser
•Install an iOS or Android SDK
26
Copyright © Terry Felke-Morris http://terrymorris.net
CSS Flexible Box Layout
Module
•Referred to as “flexbox”
•GREAT way to easily configure multi-column page layout
•elements contained within a flex container can be configured either
horizontally or vertically in a flexible manner with flexible sizing
•Flexbox is not yet well-supported by browsers.
•Check http://caniuse.com/flexbox for the current level of browser
support.
•Common Properties used with flexbox:
display flex
flex-direction order
flex-wrap justify-content
27
Copyright © Terry Felke-Morris http://terrymorris.net
Using Flexbox
Configure a flexible container “flex container”
Configure the direction of the flex
Example:
#demo { display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row; }
Adjust the proportion of the “flex item” elements in the container
Example:
nav { -webkit-flex: 1; flex: 1; }
main { -webkit-flex: 7; flex:7; }
aside { -webkit-flex:2; flex: 2 }
28
Copyright © Terry Felke-Morris http://terrymorris.net
CSS Debugging
Tips
•Manually check syntax errors
•Use W3C CSS Validator 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!
29
Copyright © Terry Felke-Morris http://terrymorris.net
Checkpoint
1. State an advantage of using CSS to style for print.
2. Describe a design consideration when configuring a web
page for mobile display.
3. Describe coding techniques that will configure an image
with a flexible display.
30
Copyright © Terry Felke-Morris http://terrymorris.net
Summary
This chapter introduced you to a variety of
topics related to hyperlinks, page layout,
and configuring responsive web pages that
display well on desktop browsers and
mobile devices.
31

More Related Content

What's hot

Introduction to HTML5 and CSS3 (revised)
Introduction to HTML5 and CSS3 (revised)Introduction to HTML5 and CSS3 (revised)
Introduction to HTML5 and CSS3 (revised)
Joseph Lewis
 

What's hot (20)

Chapter8
Chapter8Chapter8
Chapter8
 
Chapter5
Chapter5Chapter5
Chapter5
 
Chapter10
Chapter10Chapter10
Chapter10
 
Chapter1
Chapter1Chapter1
Chapter1
 
Chapter 6 - Web Design
Chapter 6 - Web DesignChapter 6 - Web Design
Chapter 6 - Web Design
 
Chapter 5 - Web Design
Chapter 5 - Web DesignChapter 5 - Web Design
Chapter 5 - Web Design
 
Introduction to HTML5 and CSS3 (revised)
Introduction to HTML5 and CSS3 (revised)Introduction to HTML5 and CSS3 (revised)
Introduction to HTML5 and CSS3 (revised)
 
Chapter 4 - Web Design
Chapter 4 - Web DesignChapter 4 - Web Design
Chapter 4 - Web Design
 
An Introduction to HTML5
An Introduction to HTML5An Introduction to HTML5
An Introduction to HTML5
 
Chapter 10 - Web Design
Chapter 10 - Web DesignChapter 10 - Web Design
Chapter 10 - Web Design
 
HTML5 & CSS3
HTML5 & CSS3 HTML5 & CSS3
HTML5 & CSS3
 
Html5
Html5Html5
Html5
 
Introduction to html 5
Introduction to html 5Introduction to html 5
Introduction to html 5
 
Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overview
 
HTML/HTML5
HTML/HTML5HTML/HTML5
HTML/HTML5
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
Training HTML5 CSS3 Ilkom IPB
Training HTML5 CSS3 Ilkom IPBTraining HTML5 CSS3 Ilkom IPB
Training HTML5 CSS3 Ilkom IPB
 
HTML5 & Friends
HTML5 & FriendsHTML5 & Friends
HTML5 & Friends
 
Css, xhtml, javascript
Css, xhtml, javascriptCss, xhtml, javascript
Css, xhtml, javascript
 
HTML5 CSS3 Basics
HTML5 CSS3 Basics HTML5 CSS3 Basics
HTML5 CSS3 Basics
 

Similar to Chapter7

4_5926925443935505826.pptx
4_5926925443935505826.pptx4_5926925443935505826.pptx
4_5926925443935505826.pptx
Lusi39
 
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
Heather Rock
 
Html5 - short intro
Html5 - short introHtml5 - short intro
Html5 - short intro
jeiseman
 
World wide web with multimedia
World wide web with multimediaWorld wide web with multimedia
World wide web with multimedia
Afaq Siddiqui
 
Web topic 9 navigation and link
Web topic 9  navigation and linkWeb topic 9  navigation and link
Web topic 9 navigation and link
CK Yang
 
Module 4 Minuteman Lexington Web Design Daniel Downs
Module 4 Minuteman Lexington Web Design Daniel DownsModule 4 Minuteman Lexington Web Design Daniel Downs
Module 4 Minuteman Lexington Web Design Daniel Downs
Daniel Downs
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
butest
 

Similar to Chapter7 (20)

Chapter 7 - Web Design
Chapter 7 - Web DesignChapter 7 - Web Design
Chapter 7 - Web Design
 
Chapter4
Chapter4Chapter4
Chapter4
 
Stanford Html5talk
Stanford Html5talkStanford Html5talk
Stanford Html5talk
 
4_5926925443935505826.pptx
4_5926925443935505826.pptx4_5926925443935505826.pptx
4_5926925443935505826.pptx
 
Day1
Day1Day1
Day1
 
Lesson 8 Computer Creating your Website.pdf
Lesson 8 Computer Creating your Website.pdfLesson 8 Computer Creating your Website.pdf
Lesson 8 Computer Creating your Website.pdf
 
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
 
Responsive content
Responsive contentResponsive content
Responsive content
 
Html5 - short intro
Html5 - short introHtml5 - short intro
Html5 - short intro
 
Website Development Guidelines
Website Development GuidelinesWebsite Development Guidelines
Website Development Guidelines
 
ARTICULOENINGLES
ARTICULOENINGLESARTICULOENINGLES
ARTICULOENINGLES
 
Understanding the Web Page Layout
Understanding the Web Page LayoutUnderstanding the Web Page Layout
Understanding the Web Page Layout
 
Theming websites effortlessly with Deliverance (CMSExpo 2010)
Theming websites effortlessly with Deliverance (CMSExpo 2010)Theming websites effortlessly with Deliverance (CMSExpo 2010)
Theming websites effortlessly with Deliverance (CMSExpo 2010)
 
Guía SEO 2020: Trucos y recomendaciones para desarrolladores y webmasters
Guía SEO 2020: Trucos y recomendaciones para desarrolladores y webmastersGuía SEO 2020: Trucos y recomendaciones para desarrolladores y webmasters
Guía SEO 2020: Trucos y recomendaciones para desarrolladores y webmasters
 
World wide web with multimedia
World wide web with multimediaWorld wide web with multimedia
World wide web with multimedia
 
Web topic 9 navigation and link
Web topic 9  navigation and linkWeb topic 9  navigation and link
Web topic 9 navigation and link
 
Module 4 Minuteman Lexington Web Design Daniel Downs
Module 4 Minuteman Lexington Web Design Daniel DownsModule 4 Minuteman Lexington Web Design Daniel Downs
Module 4 Minuteman Lexington Web Design Daniel Downs
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
 
Web Engineering Lec01-02 - Introduction to Web.pptx
Web Engineering Lec01-02 - Introduction to Web.pptxWeb Engineering Lec01-02 - Introduction to Web.pptx
Web Engineering Lec01-02 - Introduction to Web.pptx
 

More from DeAnna Gossett (18)

Chapter12
Chapter12Chapter12
Chapter12
 
Elet5e ch01
Elet5e ch01Elet5e ch01
Elet5e ch01
 
Elet5e ch20
Elet5e ch20Elet5e ch20
Elet5e ch20
 
Elet5e ch19
Elet5e ch19Elet5e ch19
Elet5e ch19
 
Elet5e ch18
Elet5e ch18Elet5e ch18
Elet5e ch18
 
Elet5e ch17
Elet5e ch17Elet5e ch17
Elet5e ch17
 
Elet5e ch16
Elet5e ch16Elet5e ch16
Elet5e ch16
 
Elet5e ch15
Elet5e ch15Elet5e ch15
Elet5e ch15
 
Elet5e ch14
Elet5e ch14Elet5e ch14
Elet5e ch14
 
Elet5e ch13
Elet5e ch13Elet5e ch13
Elet5e ch13
 
Elet5e ch12
Elet5e ch12Elet5e ch12
Elet5e ch12
 
Elet5e ch11
Elet5e ch11Elet5e ch11
Elet5e ch11
 
Elet5e ch10
Elet5e ch10Elet5e ch10
Elet5e ch10
 
Elet5e ch09
Elet5e ch09Elet5e ch09
Elet5e ch09
 
Elet5e ch08
Elet5e ch08Elet5e ch08
Elet5e ch08
 
Elet5e ch07
Elet5e ch07Elet5e ch07
Elet5e ch07
 
Elet5e ch06
Elet5e ch06Elet5e ch06
Elet5e ch06
 
Elet5e ch05
Elet5e ch05Elet5e ch05
Elet5e ch05
 

Recently uploaded

一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
F
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
F
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 

Recently uploaded (20)

一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 

Chapter7

  • 1. Copyright © Terry Felke-Morris http://terrymorris.net Web Development & Design Foundations with HTML5 8th Edition CHAPTER 7 KEY CONCEPTS 1 Copyright © Terry Felke-Morris
  • 2. Copyright © Terry Felke-Morris http://terrymorris.net Learning Outcomes In this chapter, you will learn how to ... •Code relative hyperlinks to web pages in folders within a website •Configure a hyperlink to a named fragment internal to a web page •Provide for accessibility by configuring ARIA landmark roles for structural HTML elements •Configure images with CSS sprites •Configure a three-column page layout using CSS •Configure CSS for printing •Describe mobile design best practices •Configure web pages for mobile display using the viewport meta tag •Apply responsive web design techniques with CSS3 media queries and flexible images 2
  • 3. Copyright © Terry Felke-Morris http://terrymorris.net More on Relative Linking <a href="contact.html">Contact</a> <a href="rooms/canyon.html">Canyon</a> <a href="../index.html">Home</a> <a href="../events/weekend.html">Weekend</a> 3 Relative links from the Home page: index.html Relative links from the Canyon page: rooms/canyon.html
  • 4. Copyright © Terry Felke-Morris http://terrymorris.net HTML Linking to Fragment Identifiers A link to a part of a web page Also called named fragments, fragment ids Two components: 1. The element that identifies the named fragment of a web page. This requires the id attribute. <div id=“top”> ….. </div> 2. The anchor tag that links to the named fragment of a web page. This uses the href attribute. <a href=“#top”>Back to Top</a> 4 Note the use of the # in the anchor tag!
  • 5. Copyright © Terry Felke-Morris http://terrymorris.net Landmark Roles with ARIA Accessible Rich Internet Applications (ARIA) Landmark Roles ◦banner (a header/logo area) ◦navigation (a collection of navigation elements) ◦main (the main content of a document) ◦complementary (a supporting part of the web page document, designed to be complementary to the main content ) ◦contentinfo (an area that contains information about the content such as copyright ) ◦form (an area that contains a form) ◦search (an area of a web page that provides search functionality) 5 Example: <header role=“banner”>
  • 6. Copyright © Terry Felke-Morris http://terrymorris.net Opening a Link in a New Browser Window The target attribute on the anchor element opens a link in a new browser window or new browser tab. <a href="http://yahoo.com" target="_blank">Yahoo!</a> 6
  • 7. Copyright © Terry Felke-Morris http://terrymorris.net HTML5 Block Anchor Configure block display elements within a hyperlink <a href="http://www.w3.org/TR/html-markup"> <h1>HTML5 Reference</h1> <p>Bookmark this site for a handy HTML5 reference.</p> </a> 7
  • 8. Copyright © Terry Felke-Morris http://terrymorris.net Telephone & Text Message Hyperlinks Telephone Scheme <a href="tel:888-555-5555">Call 888-555-5555</a> Many mobile browsers will initiate a phone call when the hyperlink is clicked. SMS Scheme <a href="sms:888-555-5555">Text 888-555-5555</a> Many mobile browsers will initiate a text message to the phone number when the hyperlink is clicked. 8
  • 9. Copyright © Terry Felke-Morris http://terrymorris.net CSS Sprites Sprite ◦an image file that contains multiple small graphics ◦advantage: saves download time 9
  • 10. Copyright © Terry Felke-Morris http://terrymorris.net Checkpoint 1. Describe a reason to organize the files in a website using folders and subfolders. 2. Which attribute configures a hyperlink to open the file in a new browser window or tab? 3. State an advantage of using CSS sprites in a website.
  • 11. Copyright © Terry Felke-Morris http://terrymorris.net Three Column Page Layout A common web page layout consists of a header across the top of the page with three columns below: navigation, content, and sidebar. 11
  • 12. Copyright © Terry Felke-Morris http://terrymorris.net Three Column Layout container sets default background color, text color, font typeface, and a minimum width Left-column navigation ◦float: left; width:150px; Right-column content ◦float: right; width: 200px; Center column ◦Uses the remaining screen room available room after the floating columns display ◦margin: 0 210px 0 160px; Footer – clears the float ◦clear: both; 12
  • 13. Copyright © Terry Felke-Morris http://terrymorris.net CSS Styling for Print Create an external style sheet with the configurations for browser display. Create a second external style sheet with the configurations for printing. Connect both of the external style sheets to the web page using two <link > elements. 13 <link rel="stylesheet" href="wildflower.css" type="text/css" media="screen"> <link rel="stylesheet" href="wildflowerprint.css" type="text/css" media="print">
  • 14. Copyright © Terry Felke-Morris http://terrymorris.net Print Styling Best Practices Hide non-essential content Example: #nav { display: none; } Configure font size and color for printing ◦Use pt font sizes, use dark text color Control page breaks Example: .newpage { page-break-before: always; } Print URLs for hyperlinks Example: #sidebar a:after { content: " (" attr(href) ") "; } 14
  • 15. Copyright © Terry Felke-Morris http://terrymorris.net Mobile Web Limitations Small Screen Size Low bandwidth Limited fonts Limited color Awkward controls Lack of Flash support Limited processor and memory Cost per kilobyte
  • 16. Copyright © Terry Felke-Morris http://terrymorris.net Mobile Web Design Best Practices Recommended by the W3C http://www.w3.org/TR/mobile-bp http://www.w3.org/2007/02/mwbp_flip_cards.html Optimize Layout, Navigation, Graphics, and Text for Mobile Use Design for One Web
  • 17. Copyright © Terry Felke-Morris http://terrymorris.net Optimize Layout for Mobile Use Single column design Limit scrolling to one direction Use heading elements Use lists Avoid using tables Provide labels for form controls Avoid using pixel units in style sheets Avoid absolute positioning in style sheets Hide content that is not essential for mobile use.
  • 18. Copyright © Terry Felke-Morris http://terrymorris.net Optimize Navigation for Mobile Use Provide minimal navigation near the top of the page Provide consistent navigation Avoid hyperlinks that open files in new windows or pop-up windows Try to balance both the number of hyperlinks on a page and the number of levels needed to access information
  • 19. Copyright © Terry Felke-Morris http://terrymorris.net Optimize Graphics for Mobile Use Avoid displaying images that are wider than the screen width Configure alternate, small optimized background images Some mobile browsers will downsize all images, so avoid using images that contain text Avoid the use of large graphic images Specify the size of images Provide alternate text for graphics and other non-text elements.
  • 20. Copyright © Terry Felke-Morris http://terrymorris.net Optimize Text for Mobile Use Configure good contrast between text and background colors Use common font typefaces Configure font size with em units or percentages Use a short, descriptive page title
  • 21. Copyright © Terry Felke-Morris http://terrymorris.net Viewport Meta Tag Default action for most mobile devices is to zoom out and scale the web page Viewport Meta Tag Created as an Apple extension to configure display on mobile devices Configures width and initial scale of browser viewport <meta name="viewport" content="width=device-width, initial-scale=1.0"> 21
  • 22. Copyright © Terry Felke-Morris http://terrymorris.net CSS3 Media Queries Media Query ◦Determines the capability of the mobile device, such as screen resolution ◦Directs the browser to styles configured specifically for those capabilities Example with link tag <link href="lighthousemobile.css" rel="stylesheet" media="only all and (max-device-width: 480px)"> Example within CSS @media only all and (max-width: 768px) { } 22
  • 23. Copyright © Terry Felke-Morris http://terrymorris.net Flexible Images Edit HTML: remove height and width attributes CSS: img { max-width: 100%; height: auto; } 23
  • 24. Copyright © Terry Felke-Morris http://terrymorris.net Responsive Images HTML 5.1 Picture Element <picture> <source media="(min-width: 1200px)" srcset="large.jpg"> <source media="(min-width: 800px)" srcset="medium.jpg"> <source media="(min-width: 320px)" srcset="small.jpg"> <img src="fallback.jpg" alt="waterwheel"> </picture> 24
  • 25. Copyright © Terry Felke-Morris http://terrymorris.net Responsive Images HTML 5.1 sizes & srcset Attributes <img src="fallback.jpg" sizes="100vw" srcset="large.jpg 1200w, medium.jpg 800w, small.jpg 320w" alt="waterwheel"> 25
  • 26. Copyright © Terry Felke-Morris http://terrymorris.net Testing Mobile Display Options •Test with a mobile device •Emulators • Opera Mobile Emulator • Mobilizer • iPhone Emulator •Test with a Desktop Browser •Install an iOS or Android SDK 26
  • 27. Copyright © Terry Felke-Morris http://terrymorris.net CSS Flexible Box Layout Module •Referred to as “flexbox” •GREAT way to easily configure multi-column page layout •elements contained within a flex container can be configured either horizontally or vertically in a flexible manner with flexible sizing •Flexbox is not yet well-supported by browsers. •Check http://caniuse.com/flexbox for the current level of browser support. •Common Properties used with flexbox: display flex flex-direction order flex-wrap justify-content 27
  • 28. Copyright © Terry Felke-Morris http://terrymorris.net Using Flexbox Configure a flexible container “flex container” Configure the direction of the flex Example: #demo { display: -webkit-flex; display: flex; -webkit-flex-direction: row; flex-direction: row; } Adjust the proportion of the “flex item” elements in the container Example: nav { -webkit-flex: 1; flex: 1; } main { -webkit-flex: 7; flex:7; } aside { -webkit-flex:2; flex: 2 } 28
  • 29. Copyright © Terry Felke-Morris http://terrymorris.net CSS Debugging Tips •Manually check syntax errors •Use W3C CSS Validator 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! 29
  • 30. Copyright © Terry Felke-Morris http://terrymorris.net Checkpoint 1. State an advantage of using CSS to style for print. 2. Describe a design consideration when configuring a web page for mobile display. 3. Describe coding techniques that will configure an image with a flexible display. 30
  • 31. Copyright © Terry Felke-Morris http://terrymorris.net Summary This chapter introduced you to a variety of topics related to hyperlinks, page layout, and configuring responsive web pages that display well on desktop browsers and mobile devices. 31