O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Responsive Web Design with HTML5 and CSS3

Book Description

Web pages that respond immediately to different screen sizes and devices is one of today’s essentials. Packed with screenshots and examples, this book will teach you the professional approach using just HTML5 and CSS3.

  • Everything needed to code websites in HTML5 and CSS3 that are responsive to every device or screen size
  • Learn the main new features of HTML5 and use CSS3’s stunning new capabilities including animations, transitions and transformations
  • Real world examples show how to progressively enhance a responsive design while providing fall backs for older browsers

In Detail

Tablets, smart phones and even televisions are being used increasingly to view the web. There’s never been a greater range of screen sizes and associated user experiences to consider. Web pages built to be responsive provide the best possible version of their content to match the viewing devices of not just today’s devices but tomorrow’s too.

Learn how to design websites according to the new “responsive design” methodology, allowing a website to display beautifully on every screen size. Follow along, building and enhancing a responsive web design with HTML5 and CSS3. The book provides a practical understanding of these new technologies and techniques that are set to be the future of front-end web development.

Starting with a static Photoshop composite, create a website with HTML5 and CSS3 which is flexible depending on the viewer’s screen size.

With HTML5, pages are leaner and more semantic. A fluid grid design and CSS3 media queries means designs can flex and adapt for any screen size. Beautiful backgrounds, box-shadows and animations will be added – all using the power, simplicity and flexibility of CSS3.

Responsive web design with HTML5 and CSS3 provides the necessary knowledge to ensure your projects won’t just be built ‘right’ for today but also the future.

Table of Contents

  1. Responsive Web Design with HTML5 and CSS3
    1. Responsive Web Design with HTML5 and CSS3
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Errata
        2. Piracy
        3. Questions
    7. 1. Getting Started with HTML5, CSS3, and Responsive Web Design
      1. Why smart phones are important (and old IE isn't)
      2. Are there times when a responsive design isn't the right choice?
      3. Defining responsive web design
      4. Why stop at responsive design?
      5. Examples of responsive web design
        1. Get your viewport testing tools here!
        2. Online sources of inspiration
      6. HTML5—why it's so good
        1. Saving time and code with HTML5
        2. New, semantically meaningful HTML5 tag elements
      7. CSS3 enables responsive designs and more
        1. The bottom line—CSS3 won't break anything!
        2. How can CSS3 solve everyday design problems?
      8. Look Ma'—no images!
        1. What else has CSS3 got to offer?
      9. Can HTML5 and CSS3 work for us today?
      10. Responsive web designs are not magic bullets
      11. Educating our clients that websites shouldn't look the same in all browsers
      12. Summary
    8. 2. Media Queries: Supporting Differing Viewports
      1. You can use media queries today
      2. Why responsive designs need media queries?
        1. Media query syntax
        2. What can media queries test for?
        3. Using media queries to alter our design
        4. The best way to load media queries for responsive designs
      3. Our first responsive design
        1. Don't panic but our design is fixed-width
        2. Responsive designs—making images as economical as possible
        3. Content clipping in smaller viewports
      4. Stopping modern mobile browsers from auto-resizing the page
      5. Fixing the design for different viewport widths
      6. With responsive designs, content should always come first
      7. Media queries—only part of the solution
        1. We need a fluid layout
      8. Summary
    9. 3. Embracing Fluid Layouts
      1. Fixed layouts aren't future proof
      2. Why proportional layouts are essential for responsive designs
      3. Amending a design from fixed to proportional layout
        1. A formula to remember
        2. Setting a context for proportional elements
        3. It's always important to remember the context
      4. Using ems rather than pixels for typography
      5. Fluid images
        1. Making images scale with the viewport
        2. Specific rules for specific images
        3. Putting the brakes on fluid images
        4. The incredibly versatile max-width property
      6. Serving different images for different screen sizes
        1. Setting up Adaptive Images
          1. Put background images somewhere else
      7. Where fluid grids and media queries come together
      8. CSS Grid systems
        1. Rapidly building our site with a Grid system
      9. Summary
    10. 4. HTML5 for Responsive Designs
      1. What parts of HTML5 can we use today?
        1. Most sites can be written in HTML5
        2. Polyfills, shims, and Modernizr
      2. How to write HTML5 pages
        1. Economies of using HTML5
        2. A sensible approach to HTML5 markup
        3. All hail the mighty <a> tag
        4. Obsolete HTML features
      3. New semantic elements in HTML5
        1. The <section> element
        2. The <nav> element
        3. The <article> element
        4. The <aside> element
        5. The <hgroup> element
          1. The HTML5 outline algorithm
        6. The <header> element
        7. The <footer> element
        8. The <address> element
      4. Practical usage of HTML5's structural elements
        1. What about the main content of the site?
      5. HTML5 text-level semantics
        1. The <b> element
        2. The <em> element
        3. The <i> element
        4. Applying text-level semantics to our markup
      6. Adding accessibility to your site with WAI-ARIA
        1. ARIA's landmark roles
      7. Embedding media in HTML5
      8. Adding video and audio the HTML5 way
        1. Providing alternate source files
        2. Fallback for older browsers
        3. Audio and video tags work almost identically
      9. Responsive video
      10. Offline Web applications
        1. Offline Web applications in a nut shell
        2. Making web pages work offline
        3. Understanding the manifest file
        4. Automatic loading of pages to the offline manifest
        5. About that version comment
        6. Viewing the site offline
        7. Troubleshooting Offline Web applications
      11. Summary
    11. 5. CSS3: Selectors, Typography, and Color Modes
      1. What CSS3 offers the frontend developer
        1. CSS3 support in Internet Explorer versions 6 to 8
        2. Using CSS3 to design and develop pages in the browser
      2. Anatomy of a CSS rule
      3. Vendor prefixes and how to use them
      4. Quick and useful CSS3 tricks
        1. CSS3 multiple columns for responsive designs
          1. Adding a gap and column divider
        2. Word wrapping
      5. New CSS3 selectors and how to use them
        1. CSS3 attribute selectors
          1. CSS3 substring matching attribute selectors
            1. The "beginning with" substring matching attribute selector
            2. The "contains an instance of" substring matching attribute selector
            3. The "ends with" substring matching attribute selector
          2. A practical, real world example
        2. CSS3 structural pseudo-classes
          1. The :last-child selector
          2. The nth-child selectors
          3. Understanding what nth rules do
          4. The negation (:not) selector
        3. Amendments to pseudo-elements
          1. Is :first-line handy for responsive designs?
      6. Custom web typography
        1. The @font-face CSS rule
        2. Implementing web fonts with @font-face
      7. Help—my CSS3 @font-face headings look messy
        1. A note about custom @font-face typography and responsive designs
      8. New CSS3 color formats and alpha transparency
        1. RGB color
        2. HSL color
        3. Fallback color values for IE6, IE7, and IE8
        4. Alpha channels
      9. Summary
    12. 6. Stunning Aesthetics with CSS3
      1. Text shadows with CSS3
        1. HEX, HSL, or RGB color allowed
        2. Pixels, em, or rem
        3. Preventing a text shadow
          1. Left and top shadows
        4. Creating an embossed text-shadow effect
        5. Multiple text-shadows
      2. Box shadows
        1. Inset shadow
        2. Multiple shadows
      3. Background gradients
        1. Linear background gradients
          1. Breakdown of linear gradient syntax
        2. Radial background gradients
          1. Breakdown of radial gradient syntax
        3. Repeating gradients
      4. Background gradient patterns
      5. Responsive considerations for CSS3
      6. Bringing CSS3 properties together
      7. Multiple background images
        1. Background size
        2. Background position
        3. Background shorthand
      8. More CSS3 features
      9. Sizeable icons which are perfect for responsive designs
      10. Summary
    13. 7. CSS3 Transitions, Transformations, and Animations
      1. What CSS3 transitions are and how we can use them
        1. The properties of a transition
          1. The transition shorthand property
          2. Transition different properties over different periods of time
          3. Understanding timing functions
        2. Fun transitions for responsive web sites
      2. CSS3 2D transformations
        1. What can we transform?
          1. scale
          2. translate
          3. rotate
          4. skew
          5. matrix
            1. Matrix transformations for cheats and dunces
          6. transform-origin property
      3. Dabbling in CSS3 3D transformations
        1. Breaking down the 3D effect
        2. 3D transformations not ready for prime time
      4. Animating with CSS3
        1. Putting CSS3 transformations and animations together
      5. Summary
    14. 8. Conquer Forms with HTML5 and CSS3
      1. HTML5 forms
        1. Understanding the component parts of HTML5 forms
        2. placeholder
        3. required
        4. autofocus
        5. autocomplete
        6. list (and the associated datalist element)
        7. HTML5 input types
          1. email
          2. number
          3. url
          4. tel
          5. search
          6. pattern
          7. color
        8. Date and time inputs
          1. date
          2. month
          3. week
          4. time
          5. datetime and datetime-local
          6. range
      2. How to polyfill non-supporting browsers
      3. Styling HTML5 forms with CSS3
        1. Form-specific CSS3 pseudo class selectors
      4. Summary
    15. 9. Solving Cross-browser Responsive Challenges
      1. Progressive enhancement versus graceful degradation
        1. Reality
      2. Should you fix old versions of Internet Explorer?
        1. Statistics (again)
        2. Personal choice
      3. Modernizr—the frontend developer's Swiss army knife
        1. Fix styling issues with Modernizr
        2. Modernizr adds HTML5 element support for old IE
        3. Add min/max media query capability for Internet Explorer 6, 7, and 8
        4. Conditional loading with Modernizr
      4. Changing navigation links to a drop menu (conditionally)
      5. High resolution devices (the future)
      6. Summary