Giter VIP home page Giter VIP logo

real-life-subgrid-examples's Introduction

Real-life subgrid

This simple codebase shows why subgrid is useful.

Imagine that your brief is to create a set of four content cards, each with a header, description and footer. The content in each of the cards has to align vertically across viewports and the size of the content should not break this vertical alignment - all the cards should grow and shrink to match each other.

The examples

There are four examples in this codebase:

  • 1-set-height shows how you would create a set of content cards using "magic numbers" that quickly break as soon as the content gets too long - you don't ever want to use this kind of brittle implementation on a production site
  • 2-flex-box shows how you would create the same set of content cards using flexbox, but this is still not ideal
  • 3-grid using grid to create the content cards is a lot easier and this feels like we're on the right track
  • 4-subgrid aligning the content in the cards is suddenly a lot easier! Subgrid is intended to solve exactly this sort of problem.

Running the examples

I just run these examples using the LiveServer extension in VS Code. Once it's been installed you can just right-click on the index.html for each example and hit "Open with LiveServer"

Remember to use a browser that supports subgrid when opening the subgrid example!

real-life-subgrid-examples's People

Contributors

dana-ciocan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.