Book Image

Mastering PostCSS for Web Design

By : Alex Libby
Book Image

Mastering PostCSS for Web Design

By: Alex Libby

Overview of this book

PostCSS is a tool that has quickly emerged as the future of existing preprocessors such as SASS and Less, mainly because of its power, speed, and ease of use. This comprehensive guide offers in-depth guidance on incorporating cutting-edge styles into your web page and at the same time maintaining the performance and maintainability of your code. The book will show how you can take advantage of PostCSS to simplify the entire process of stylesheet authoring. It covers various techniques to add dynamic and modern styling features to your web pages. As the book progresses, you will learn how to make CSS code more maintainable by taking advantage of the modular architecture of PostCSS. By the end of this book, you would have mastered the art of adding modern CSS effects to web pages by authoring high performing, maintainable stylesheets.
Table of Contents (21 chapters)
Mastering PostCSS for Web Design
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Adding responsive capabilities


Although Bourbon does add a degree of responsivity to our code, it's not quite enough for our needs. If we try resizing our demo, it soon becomes apparent that the elements don't quite go where we would want them, to say the least!

The quickest way to see just how the design looks when resized for smaller devices is to use Google Chrome. Press Shift + Ctrl + I to enable Chrome's developer tools:

The design works well when viewed at 1280px x 1024px, but this soon changes if we change the available viewing estate to suit an Apple iPhone 6 at 375px by 627px:

See what I mean? It just doesn't look right, does it? Fortunately, it's easy to fix using PostCSS, so let's dive in and see what is required to get our design working again.

Correcting the design

Getting our design to work properly for smaller devices such as iPhones is easy when working with PostCSS: we can use the postcss-media-minmax plugin available from https://github.com/postcss/postcss-media-minmax.

"How...