Web Development & Design Foundations with HTML5

Skip to Content 9th 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.

CSS3 Flexible Box Layout

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!

Check out the following resources to explore Flexbox:

CSS Grid Layout

The purpose of CSS Grid Layout (https://www.w3.org/TR/css-grid-1/) is to configure a two-dimensional grid-based layout. The grid can be created as either fixed-size or flexible and contains one or more grid items that can be individually defined as fixed-size or lexible. CSS Grid Layout is optimized for two-dimensional page layout. In addition to configuring grid organization of elements, CSS Grid Layout can also be used to change the order of display of the elements. Check http://caniuse.com/css-grid for the current level of browser support.

Visit the following resources to explore CSS Grid Layout:

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 314-320)
    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.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.

  • Page 347
    To configure the grid shown in Figure 7.37 you also need to configure the third row (footer row). The code sample in the middle of the page should be:
    #mygrid { display: grid;
              grid-tempolate-colulmns: 150px 1fr;
              grid-template-rows: 200px auto 100px; }
          
  • Page 355
    Remove the second opening main tag from the code sample.

  • Hands-On Exercise #8, #9, #10, #11, Page 358
    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