A fluid grid of square units.

Overview

Fluid-Squares

What is it?

A fluid grid of square units using HTML and CSS.

Fluid Squares preserves a unit's square proportion within a fluid layout. The number of columns also reduce to suit browser or device width using CSS media queries.

It works on all modern desktop browsers. Media queries are written Mobile First. IE8 doesn't support media queries, so the css3-mediaqueries.js polyfill is temporarily included.

See www.fluidsquares.com for more.

What problem does Fluid Squares fix?

Without a fix, the result of reducing a browser window's width squashes a fluid grid's squares into rectangles.

To fix this each unit's padding-bottom size is set to match its width in percentages. On top of that each unit is a percentage of the global container to determine how many columns there are.

Setting a unit's width to 25% and padding-bottom to 25% will give you four units in a row that will remain square regardless of screen size or browser window resizing.

The ingredients

HTML

The basic structure of each unit is a div for content, which is nested in an anchor element:

<a href="url">
<div>content</div>
</a>

If you don't want the entire unit to be a link, a class has been created for that purpose. Just remove the anchor element and add class="category" to the div instead.

<div class="category">content</div>

CSS

Media queries control the number of columns displayed (1, 2, 3, and 4) on browser resize, as well as providing fine control over font sizes.

It includes a cut down CSS reset to suit this bare bones grid. Replace with a fresh Reset or Normalize and customise to suit your own needs.

No wrapper?

It uses the body tag as a wrapper, but would certainly work within a standard div wrapper or HTML5 block elements.

You might also like...

Explore units, stats and more

AoE 4 Explorer An useful visualization and UI to explore units, their stats and abilities and all possible upgrades and technologies for Age Of Empire

Dec 8, 2022

🧱 Easily extend native three.js materials with modular and composable shader units and effects

🧱 Easily extend native three.js materials with modular and composable shader units and effects

three-extended-material Easily extend native three.js materials with modular and composable shader units and effects. Usage npm install three-extended

Dec 2, 2022

Module to convert units for distances, weights and temperatures!

Unit Converter (Distance, Temperature, Weights) Every unit you can see in this file can be transformed into any of the other units. The Calculator wor

Jan 27, 2022

A dedicated desktop app that enables you to move items in and out of storage units in CSGO.

CASEMOVE Casemove is an open-source desktop application that helps you easily move items out of and into Storage Units in Counter-Strike: Global Offen

Dec 24, 2022

Firefox plugin to automatically translate ° Fahrenheit and size measurements into european units

Firefox plugin to automatically translate ° Fahrenheit and size measurements into european units

Eurofox 🇪🇺 🔥 🦊 Firefox plugin to automatically translate ° Fahrenheit, weights, speed and size measurements into european units. To see the origin

Oct 16, 2022

Grid based on CSS3 flexbox

Flexbox Grid flexboxgrid.com Grid based on the flex display property. Install npm npm i flexboxgrid --save bower bower install flexboxgrid cdn CDNJS

Jan 2, 2023

JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team âš¡

JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team âš¡

Handsontable is a JavaScript component that combines data grid features with spreadsheet-like UX. It provides data binding, data validation, filtering

Jan 1, 2023

A draggable and resizable grid layout with responsive breakpoints, for React.

A draggable and resizable grid layout with responsive breakpoints, for React.

React-Grid-Layout React-Grid-Layout is a grid layout system much like Packery or Gridster, for React. Unlike those systems, it is responsive and suppo

Jan 4, 2023

JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team âš¡

JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team âš¡

Handsontable is a JavaScript component that combines data grid features with spreadsheet-like UX. It provides data binding, data validation, filtering

Dec 31, 2022

Grid based on CSS3 flexbox

Flexbox Grid flexboxgrid.com Grid based on the flex display property. Install npm npm i flexboxgrid --save bower bower install flexboxgrid cdn CDNJS

Dec 31, 2022

JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team âš¡

JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team âš¡

Handsontable is a JavaScript component that combines data grid features with spreadsheet-like UX. It provides data binding, data validation, filtering

Dec 28, 2022

A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images.

A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images.

jQuery GRIDDER 1.4.2 ======= A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images. We have all

Nov 6, 2022

Nice, sleek and intuitive. A grid control especially designed for bootstrap.

jQuery Bootgrid Plugin Nice, sleek and intuitive. A grid control especially designed for bootstrap. Getting Started jQuery Bootgrid is a UI component

Dec 16, 2022

jQuery grid plugin

jqGrid jQuery grid plugin jqGrid is an Ajax-enabled JavaScript control that provides solutions for representing and manipulating tabular data on the w

Jan 7, 2023

Lightweight Grid jQuery Plugin

Lightweight Grid jQuery Plugin

jsGrid Lightweight Grid jQuery Plugin Project site js-grid.com jsGrid is a lightweight client-side data grid control based on jQuery. It supports basi

Dec 31, 2022

A motion hover effect for a background grid of images.

A motion hover effect for a background grid of images.

Image Grid Motion Effect A motion hover effect for a background grid of images. Article on Codrops Demo Installation Install dependencies: npm install

Dec 31, 2022

A tutorial on how to create a thumbnail grid with an expanding image preview similar to the effect seen on Google Images.

Thumbnail Grid with Expanding Preview A tutorial on how to create a thumbnail grid with an expanding image preview similar to the effect seen on Googl

Jan 4, 2023

A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images.

A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images.

jQuery GRIDDER 1.4.2 ======= A jQuery plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images. We have all

Nov 6, 2022

Minimalistic portfolio/photography site with masonry grid, page transitions and big images.

Gatsby Starter Portfolio: Emilia Minimalistic portfolio/photography site with masonry grid, page transitions and big images. Themeable with Theme UI.

May 20, 2022
Comments
  • Explore using CSS vw and vh units

    Explore using CSS vw and vh units

    Explore using CSS vw and vh (vertical width and height) units to improve Fluid Squares.

    Fluid Squares currently sets a unit's width to 25% and padding-bottom to 25% to achieve squares that retain their proportion in a fluid layout. This method is very simple in code but requires explanation as to why it works the way it does. The vw and vh units may provide the same result but in a way that's easier to understand.

    Fluid Squares also uses media queries to define the size of typography, which can be cumbersome to maintain. The vw and vh units may remove the dependency on media queries to adjust font sizes.

    See:

    • http://caniuse.com/#feat=viewport-units
    • http://css-tricks.com/viewport-sized-typography/
    enhancement 
    opened by crozynski 0
Owner
Craig Rozynski
Craig Rozynski
A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.

Jonny Chen 15 Dec 29, 2022
A Stylis 4.x plugin that translates pixel units to rem units

stylis-px2rem-plugin A Stylis 4.x plugin that translates pixel units to rem units. Installation With npm $ npm install stylis-px2rem-plugin With yarn

oncar 13 Sep 15, 2022
Javascript client library for the Square Connect APIs

Square Connect Node.js SDK - DEPRECATED NOTICE: The Square Connect Node.js SDK is deprecated and replaced by square/square-nodejs-sdk This Square Conn

Square 82 Sep 24, 2022
Grid-tool - Small tool that allows you to integrate a predefined or generated grid into your front-end development environment.

Grid tool Small tool that allows you to integrate a predefined or generated grid into your front-end development environment. Tool installation includ

hmongouachon 2 Jan 4, 2022
A lightweight, easy-to-use jQuery plugin for fluid width video embeds.

Introducing FitVids.js A lightweight, easy-to-use jQuery plugin for fluid width video embeds. FitVids automates the Intrinsic Ratio Method by Thierry

Dave Rupert 4.8k Dec 24, 2022
A lightweight carousel library with fluid motion and great swipe precision

Embla Carousel Embla Carousel is a bare bones carousel library with great fluid motion and awesome swipe precision. It's library agnostic, dependency

David 2.8k Jan 4, 2023
Generate font size variables for a fluid type scale with CSS clamp.

Fluid Type Scale Calculator Generate font size variables for a fluid type scale with CSS clamp. Overview Customize everything, grab the output CSS, an

Aleksandr Hovhannisyan 136 Dec 31, 2022
Generate fluid, custom property based design systems on the fly — entirely based on Utopia

Fluid Design Systems With Netlify On-demand Builders A proof of concept demonstrating how Netlify on-demand builders can help generate fluid, custom p

George Francis 53 Jan 5, 2023
A simple calculator for how many units of insulin to take with a meal depending on current and target blood sugar levels.

Insulin-Calculator One of my first programs, made to try building javascript-read HTML forms. A simple calculator for how many units of insulin to tak

Athena 1 Dec 26, 2021
The ManageYourCompany 📈 project is a project that creates, deletes, updates companies, units and assets.

The ManageYourCompany ?? project is a project that creates, deletes, updates companies, units and assets. The rule is that every company has several units and the units have several assets, these assets are machines with several fields: Name, status, person in charge, image, among others... This is a project in order to exercise my Backend skills with NodeJs and front with react.

Bruno da Silva Leite 2 Feb 9, 2022