Modern CSS
Modern CSS
Minimum price
Suggested price
Modern CSS

This book is 100% complete

Completed on 2020-05-26

About the Book

A lot of developers are intimidated by CSS. While it is true that CSS is a complicated topic, we can approach it step by step and gain mastery over it.

This book is a tour of modern CSS. It starts with the basic, fundamental concepts like the box model, specificity, selectors, colors, and units. Once you have a solid foundation, we move on to basic styling - text, backgrounds, borders, sizing, and more. As this book is about modern CSS, we will also cover transitions and animations. Finally, we will also cover CSS layout topics - floats, Flexbox, and CSS Grid.

Every concept is accompanied by code examples, and a screenshot of how the example is rendered in a browser.

Modern CSS is aimed at beginners, or experienced developers who need a CSS refresher.

As the title implies, we will be focusing on CSS features supported by modern browsers - Chrome, Firefox, Edge, and Safari. Some of the topics covered in this book will not work with Internet Explorer.

Topics covered include:

  • box model
  • specificity
  • selectors
  • units
  • colors
  • inline vs block elements
  • backgrounds
  • gradients
  • shadows
  • borders
  • text and fonts
  • layout
  • positioning
  • transforms
  • transitions
  • animations
  • floats
  • responsive design
  • Flexbox
  • CSS Grid

About the Author

Joe Attardi
Joe Attardi

I have been developing software professionally since 2004, working at companies such as Nortel, Dell, Constant Contact, and Salesforce.

For many years, I was squarely in the Java camp, and JavaScript was an afterthought. Over the years, I became more interested in frontend development, and started using JavaScript more and more.

In 2015 I took a job at Constant Contact doing only front-end development. Since then, I haven't looked back. JavaScript is my primary area of expertise now. I have worked with several JavaScript frameworks (though I may not remember how to use all of them off the top of my head!) such as Angular, React, Svelte, and Vue.

I live in the Boston area with my wife, son, and two cats.

You can find my web site at, and you can find me on Twitter at @JoeAttardi.

Table of Contents

  • Introduction
    • Who this book is for
    • What this book is not
    • Code samples
  • What is CSS?
    • Anatomy of a CSS rule
    • How CSS is used
    • CSS resources
    • A note on browser support
  • How CSS works
    • The Document Object Model (DOM)
    • The CSS Object Model (CSSOM)
    • The render tree, layout, and paint
    • Further reading
  • The CSS box model
    • Box model basics
    • Box sizing
    • Further reading
  • CSS selectors
    • Basic selector types
    • Combining selectors
    • Selector combinators
    • Pseudo-classes
    • Pseudo-elements
    • Specificity
    • Further reading
  • Basic CSS concepts
    • Units
    • Functions
    • Colors
    • Block and inline elements
    • Overflow
    • Further reading
  • Basic styling
    • Global keywords
    • Multiple values
    • Borders
    • Backgrounds
    • Gradients
    • Box shadows
    • Opacity
    • Hiding elements
    • Further reading
  • Text styling
    • Fonts
    • Basic text styling
    • Text layout
    • Using web fonts
    • Text shadow
    • Further reading
  • CSS variables
    • Using variables
    • Changing variables at runtime
    • Further reading
  • Layout and positioning
    • Padding and margin
    • Width and height
    • Positioning elements
    • Z-index and stacking contexts
    • Floats
    • Further reading
  • Transforms
    • Perspective
    • Rotation
    • Translation
    • Scaling
    • Skewing
    • Applying multiple transforms
    • Example: Making a heart with CSS
    • Example: Making a cube with CSS
    • Further reading
  • Transitions and animations
    • Transitions
    • Animations
    • Performance implications
    • JavaScript events
    • Other tips
    • Further reading
  • Flexbox
    • Basic concepts
    • A basic flex layout
    • Sizing
    • Alignment and spacing
    • Ordering
    • Examples
    • Flexbox cheat sheet
    • Further reading
  • Responsive design
    • Media query basics
    • The viewport tag
    • Breakpoints
    • Responsive layouts with flexbox
    • Fluid typography
    • Adapting a layout with media queries
    • Further reading
  • CSS Grid
    • Basic concepts
    • Basic grids
    • Grid sizing
    • Grid flow
    • Alignment
    • Grid cheat sheet
    • Further reading
  • Wrapping up

Authors have earned$9,095,176writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub