Mastering CSS Grid: A comprehensive and practical guide to creating beautiful layouts with CSS Grid 180461484X, 9781804614846

Explore the full spectrum of CSS Grid concepts and efficiently leverage its specifications with a project that incorpora

1,721 46 29MB

English Pages 330 Year 2023

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Cover
Title Page
Copyright
Dedication
Contributors
Table of Contents
Preface
Part 1–Working with CSS Grid
Chapter 1: Understanding the Basic Rules and Structures for CSS Grid
Technical requirements
Understanding the basic rules related to CSS Grid
Defining grid terminology
Creating our first grid
Arranging grid elements
Adding some breathing room (or gaps)
Using grid templates
Naming grid rows and columns
Grid flow
Understanding special grid-related units, keywords, and functions
The fractional unit
Sizing keywords and functions
Repetitive column and row definitions
Using shortcuts
The grid attribute
The grid-template attribute
The grid-row and grid-column attributes
The gap attribute
Summary
Chapter 2: Project Introduction: What We’ll Work on and First Tasks
Technical requirements
Introducing Awesome Analytics – our gibberish analytics tool
Setting up Awesome Analytics locally
Receiving our first task – implementing the grids
Exploring the code of Awesome Analytics
The CSS structure
The HTML structure
The JavaScript structure
Fixing Awesome Analytics’ layout problem – a possible solution
Analyzing the problem
Creating the page layout
Arranging the chart boxes
Summary
Chapter 3: Building Advanced Grid Layouts
Technical requirements
Understanding the row axis and column axis and how to influence them
Arranging grid items and grid cells with alignment and justification rules
Aligning and justifying items
Aligning and justifying the entire grid within its container
Defining and using advanced grid templates
Defining empty cells in grid area templates
Naming grid areas implicitly
Practicing creating flexible layouts with JavaScript
Arranging nested child elements in parent grids
Creating subgrids
Understanding how subgrids work
Understanding what is inherited
Understanding subgrids’ current state of development (as of 2023)
Masonry layouts
Understanding what masonry layouts are
Using masonry layouts with CSS Grid and knowing about its pitfalls
Practicing with Awesome Analytics
Receiving the task
Implementing a possible solution
Summary
Part 2 – Understanding the CSS Grid Periphery
Chapter 4: Understanding and Creating Responsive and Fluid Grid Layouts
Technical requirements
Understanding the challenges of designing layouts
Existing things
The content
The target groups
The stakeholders
The web design principles
Understanding the difference between adaptive, responsive, and fluid layouts
Adaptive layouts
Responsive layouts
Fluid layouts
Learning responsive layout best practices
Prioritizing content
Applying mobile first
Designing with worst-case content in mind
Combining adaptiveness, responsiveness, and fluidity
Implementing responsive and fluid layouts with CSS Grid
Media queries and altering grid area templates
Using sizing keywords and functions for fluid layouts
Practicing responsive layouts with Awesome Analytics
The task at hand
A possible solution
Summary
Chapter 5: Implementing Layouts with Flexbox and CSS Grid
Technical requirements
Arranging media objects
Arranging teasers and card elements
Arranging forms and form elements
Input groups
Compound form elements
Form layouts
Building page layouts and partials
Headers and navigation
Footers
Building entire pages
Practicing with Awesome Analytics
Analyzing the code base
Adjusting the header
Adjusting the chart boxes
Adjusting the page layout
Adjusting the chart box container
Conclusion
Summary
Chapter 6: Benefits of Grid Layouts and When Not to Use Them
Technical requirements
Cherishing the benefits of grid layouts
The ease of design and development
Visual appeal
Simple to adapt and expand
Understanding the drawbacks of grid layouts
Compatibility with content
Losing identity
The temptation of packing things too tight
Being restricted
Learning about some alternatives for grid layouts
Breaking out of the grid
Using animations
Using different shapes
A list to help us decide
Summary
Part 3 – Exploring the Wider Ecosystem
Chapter 7: Polyfilling CSS Grid’s Missing Features
Technical requirements
Understanding the tools to write a CSS polyfill from scratch
Understanding PostCSS
Understanding how to write PostCSS plugins
Understanding Browserify
Tying loose ends
Creating a polyfill for subgrid
Understanding how subgrid is meant to work
Why and when the polyfill may be useful
Writing a polyfill
Why we shouldn’t use this polyfill
Creating a polyfill for masonry
Understanding how masonry is meant to work
Why and when the polyfill may be useful
Writing the polyfill
Why we shouldn’t use this polyfill
Creating a polyfill for additional pseudo-classes
Understanding the idea behind nth-row and nth-col
Why and when the polyfill may be useful
Writing the polyfill
Why we shouldn’t use this polyfill
Animating grids
Understanding the goal of grid animations
Using the animate-css-grid library
Understanding why we should not use polyfills
Summary
Chapter 8: Grids in the Wild – How Frameworks Implement Grids
Technical requirements
Learning how Tailwind implements grids
Learning how Bootstrap implements grids
Learning how Foundation implements grids
Float grid
Flex grid
XY grid
Learning how Bulma.io implements grids
Learning how UIkit implements grids
Learning how Pure.css implements grids
Learning how Tachyons implements grids
Learning how Cutestrap implements grids
Learning how other frameworks don’t implement grids
Practising Bootstrap and Tailwind frameworks with AwesomeAnalytics
Implementing Tailwind’s grid
Implementing Bootstrap’s grid
Summary
Part 4 – A Quick Reference
Chapter 9: Quick Reference and Cheat Sheet
Technical requirements
Important terms and their definitions
CSS Grid attributes, values, functions, and units
Display property values
CSS Grid recipes for everyday use cases
Holy grail layouts
Responsive Holy grail layouts using grid areas
Dashboard box arrangement
A fluid image gallery with a fixed aspect ratio and minimum element width
Media objects
Full-height pages with a sticky header
Screen-filling sections for landing pages
Gantt charts
Grid design best practices and do’s and don’ts
A framework cheat sheet for the Holy grail layout
Tailwind
Bootstrap
Foundation (XY Grid only)
Bulma.io
UIKit
Pure.css
Tachyons
Cutestrap
Summary
Index
About Packt
Other Books You May Enjoy

Mastering CSS Grid: A comprehensive and practical guide to creating beautiful layouts with CSS Grid
 180461484X, 9781804614846

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers