Web Development & Design Foundations with HTML5

Skip to Content 8th Edition

Chapter 7 More on Links, Layout, and Mobile

Now that you've had some experience coding HTML and CSS, you're ready to explore a variety of techniques in this chapter, including relative hyperlinks and named fragment hyperlinks, CSS sprites, ARIA landmark roles, three-column page layout, styling for print, styling for mobile browsers, configuring CSS3 media queries to target mobile devices, and exploring the new CSS3 Flexbox layout model.

CSS Sprites

CSS pseudo-classes are used in combination with background images to configure image "rollovers". When using CSS Sprites, you take this a step further: combine all multiple background images in one file and use positioning properties to display the appropriate image. See the following tutorials for an introduction to this popular technique

Web-based sprite generators can help you get up and running with CSS Sprites quickly:

Responsive Web Design

Media Queries Examples & Tutorials

Designing for the Mobile Web

Testing Mobile Display

Responsive Images

Exploring CSS3 & HTML5

Adobe's new resource site, http://theexpressiveweb.com, showcases new HTML5 & CSS3 coding techniques, including CSS3 Animations, CSS3 Media Queries, HTML5 Canvas, Web Storage, and more! The site is organized by coding techniques, called "features" by Adobe — and provides for each feature with an overview, examples, browser support chart, detection and fallback strategies, and list of related Adobe technologies.

ARIA Landmark Roles

The W3C’s Web Accessibility Initiative (WAI) has developed a standard to provide for additional accessibility, called Accessible Rich Internet Applications (ARIA). Use ARIA landmark roles to indicate semantic areas on a web page such as banner, form, main, and so on.

CSS3 Flexible Box Layout Model

You have used the CSS float property to create the look of two-column and three-column web pages. While the float layout technique is still a common practice, there is a new emerging flexbox layout technique that uses the CSS3 Flexible Box Layout Module (http://www.w3.org/TR/css3-flexbox/) which is currently in W3C Candidate Recommendation status. The purpose of flexbox is to provide for a flexible layout—elements contained within a flex container can be configured either horizontally or vertically in a flexible manner with flexible sizing. In addition to changing the horizontal or vertical organization of elements, flexbox can also be used to change the order of display of the elements. Due to its flexibility, flexbox is ideally suited for
responsive web design!

Although you can expect increasing levels of browser support with each new version, Flexbox is not yet wellsupported by browsers. Check http://caniuse.com/flexbox for the current level of browser support. At the time this was written, Opera and Chrome (using the -webkit prefix) supported flexbox. Check out the following resources to explore Flexbox:

Review Activities

Review game activities are available for this chapter.
Check your knowledge of chapter terms and concepts.

Chapter Updates

  • Hands-On Practice 7.5 (pages 316-322)
    The chapter7/7.5/index.html file in the Student Files has an error. Edit the HTML and change id="floatright" to class="floatright".

  • Hands-On Practice 7.6 (pages 325-327)
    When you validate your pages you may get error warnings about the ARIA landmark roles. According to Deque, configuring both HTML5 elements and ARIA landmark roles is a best practice because screen reader support for HTML5 is incomplete.

  • Hands-On Practice 7.10 (pages 338-339)
    Use the Firefox browser to test your work. It seems that Chrome's support of the image element's srcset and sizes attributes is a bit buggy.

  • Hands-On Exercise #9, #10, #11, Page 355
    The chapter7/7.5/index.html file in the Student Files has an error. Edit the HTML and change id="floatright" to class="floatright".

Questions or Comments?

The author would like to hear from you! Send an e-mail to webdevfoundations@gmail.com