Book Image

Mastering Responsive Web Design

By : Ricardo Zea
Book Image

Mastering Responsive Web Design

By: Ricardo Zea

Overview of this book

Building powerful and accessible websites and apps using HTML5 and CSS3 is a must if we want to create memorable experiences for our users. In the ever-changing world of web design and development, being proficient in responsive web design is no longer an option: it is mandatory. Each chapter will take you one step closer to becoming an expert in RWD. Right from the start your skills will be pushed as we introduce you to the power of Sass, the CSS preprocessor, to increase the speed of writing repetitive CSS tasks. We’ll then use simple but meaningful HTML examples, and add ARIA roles to increase accessibility. We’ll also cover when desktop-first or mobile-first approaches are ideal, and strategies to implement a mobile-first approach in your HTML builds. After this we will learn how to use an easily scalable CSS grid or, if you prefer, how to use Flexbox instead. We also cover how to implement images and video in both responsive and responsible ways. Finally, we build a solid and elegant typographic scale, and make sure your messages and communications display correctly with responsive emails.
Table of Contents (16 chapters)
Mastering Responsive Web Design
About the Author
About the Reviewers

Creating a custom CSS grid

Since we're mastering RWD, we have the luxury of creating our own CSS grid. However, we need to work smart, not hard. So what we're going to do is leverage the Variable Grid System app and combine its result with our own approach, making a mobile-first, fluid, custom build, and solid CSS grid from which we can create robust responsive designs.

Let's lay out our CSS grid requirements:

  • It should have 12 columns.

  • It should be 1200px wide to account for 1280px screens.

  • It should be fluid, with relative units (percentages) for the columns and gutters.

  • It should use the mobile-first approach.

  • It should use the SCSS syntax.

  • It should be reusable for other projects.

  • It should be simple to use and understand.

  • It should be easily scalable.

Here's what our 1200 pixel wide and 12-column width 20px grid looks like:

The left and right padding in black are 10px each. We'll convert those 10px into percentages at the end of this process.

Doing the math

We're going to use the RWD magic formula...