GithubHelp home page GithubHelp logo

webin / css-masonry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bobbigmac/css-masonry

0.0 2.0 0.0 6 KB

Very simple CSS-only masonry for Meteor using css column-count and column-gap

License: MIT License

JavaScript 29.47% CSS 70.53%

css-masonry's Introduction

CSS-Masonry

Very simple css-only masonry layout using css3's column-count and column-gap. Doesn't rely on fixed heights, intended to work with Meteor/Blaze without having to bind up rendered handlers to tie in isotope (and all the management/cleanup that comes with that whole mess).

Responsive and increases column-count at Bootstrap breakpoint dimensions, though will work just fine without Bootstrap.

I use this layout in a lot of projects so this is basically just a starting-point and something to refer to, override with your desired margins/column-counts as needed. Check the source, it's not fancy.

CSS columns are pretty well supported: http://caniuse.com/#feat=multicolumn

Usage

<div class="masonry-wall">
	<div class="masonry-brick">
		<h1>Some big content<br /><br/>More stuff</h1>
	</div>
	<div class="masonry-brick masonry-no-break"><!-- will not wrap content to next column-->
		<h6>Some <small>not as big</small> content</h6>
	</div>
	<!-- etc -->
</div>

or to be a bit more bootstrappy...

<div class="masonry-wall">
	{{#each someThingsHavePictures}}
		<div class="masonry-brick">
			<div class="panel panel-default">
				<div class="panel-heading"><h2 class="panel-title">{{this.name}}</h2></div>
				{{#if this.img}}
					<div class="panel-body">
						<img class="panel-image" src="{{this.img}}" />
					</div>
				{{/if}}
			</div>
		</div>
	{{/each}}
</div>

Cap column-count

Added in 1.0.0... cap the number of columns (i.e. don't use 4 columns at max-res) by applying to .masonry-wall class of masonry-cap-1, masonry-cap-2 or masonry-cap-3.

Thanks

Based entirely on http://w3bits.com/css-masonry/

Feedback

Any feedback and PRs welcome

css-masonry's People

Contributors

bobbigmac 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.