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 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
- Ethan Marcotte's Responsive Web Design Article
- Return of the Mobile Stylesheet
- W3C CSS3 Media Queries
- Use of CSS in the Wild
- Viewport Sizes
- Responsive Web Design Basics - Google
Media Queries Examples & Tutorials
- CSS-Tricks Media Queries Code Snippets
- Media Queries Examples
- Sample Media Queries
- Ems in CSS Media Queries
- Retina Display Media Query
- How to Choose Breakpoints - Google
Designing for the Mobile Web
- W3C Mobile Web Initiative
- W3C Mobile Web Best Practices (MWBP 1.0)
- Flip Cards for MWBP 1.0
- Mobile First
- Mobile Web Development
- Mobile First Helps with Big Issues
- Mobile Should Come First
- Opera Mini: Web Content Authoring Guidelines
Testing Mobile Display
- Chris Pederick's Web Developer Extension (Resize > Display Window Size)
- Opera Mobile Emulator (Windows Only download and install)
- Mobilizer (Windows and Mac download and install -- free seven day trail)
- Web-Based Opera Mini 6 Simulator (Runs in a browser window)
- iPhone Emulator (Runs in a browser window)
- iPhoney (Mac only download and install)
- Am I Responsive
- Responsive Test
- iOS SDK (Mac only)
- Android SDK
- Flexible Images with CSS
- W3C Spec: Picture Element
- HTML5 Hub Picture Element
- Improving Responsive Images with the Picture Element
- A Complete Guide to the Picture Element
- Responsive Images Community Group
- Responsive Images: Use Cases and Documented Code Snippets
- Responsive Images Sizes Attribute
- Browser Support
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 game activities are available for this chapter.
Check your knowledge of chapter terms and concepts.
- 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.
Questions or Comments?
The author would like to hear from you! Send an e-mail to email@example.com