Coder Social home page Coder Social logo

syedpeer / masonry-css-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jessekorzan/masonry-css-js

0.0 0.0 0.0 525 KB

CSS masonry layout, only needs JS to re-order an array, no DOM manipulation

Home Page: https://masonry-css-js.netlify.com/

CSS 59.24% HTML 16.85% JavaScript 23.92%

masonry-css-js's Introduction

problem image

CSS column-count for masonry-style layouts is dead easy (couple lines of CSS and very minimal markup to get it going).

The Problem

The problem (sometimes) is the way the content flows (see the diagram above). Typically, I want a left-to-right scan reading experience, i.e. cards of blog post summaries with the most recent posts to appear at the top of the view. I also don't want to use JS for the layout. Pure CSS... all the way.

The Solution

The only "help" that JS provides is re-ordering the array before rendering to the view so that we can use CSS column-count for the layout. Again, for example, this array could be a feed of recent news posts.

Check the demo: here

Check out the code: react component

Post on Medium: Easy CSS Masonry Layout w/ Left-To-Right Content Flow

Special thanks to my Klue teammate @nickb for figuring out the array re-order (and in a way even I could understand).


This project was bootstrapped with Create React App.

Here's the guide here.

masonry-css-js's People

Contributors

dev7ch avatar jessekorzan 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.