PureCSS layout grid and menu

PureCSS is a set of responsive, small (3.7kb) and mobile-focused CSS modules.

To add it we use the unpkg CDN :

<head>
//these 2 first are for the PureCSS and responsive grid modules
    <link rel="stylesheet" href="https://unpkg.com/purecss@2.1.0/build/pure-min.css" integrity="sha384-yHIFVG6ClnONEA5yB5DJXfW2/KC173DIQrYoZMEtBvGzmf0PKiGyNEqe9N6BNDBH" crossorigin="anonymous">
    <link rel="stylesheet" href="https://unpkg.com/purecss@2.1.0/build/grids-responsive-min.css">
    
//we also need to include minimize.css and viewpoint for the zoom 
    <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.1/build/base-min.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

We can integrate it into our project build with npm:

//in the terminal we
$ npm install purecss --save 

//to load the project
require('purecss')

Fonts can be implemented:

The responsive grid is implemented with pure-g and pure-u classes:

Some grid

For responsive images we need pure-img, use box-sizing to give each element padding without breaking the layout:

Also, we can add the hidden attribute:

We use pure-form and pure-input for the input container and the input :

We can set the number of rows on a textarea and set input as required,disabled or readonly (can't type):

The pure-u can change the layout of the form:

Due to the pure-u-1-3 or pure-u-2-3 on the <div>inputs we have different layouts, also we need the pure-form-stacked to keep the spacing for the inputs and labels:

pure-u-2-3 form
pure-u-1-3 form

Button, checkbox, and Tables

We use pure-button for both <a> and <button>:

Radio and buttons

For the checkbox and radio, we need form, label, and input:

We can style HTML tables:

Menus are organized like lists, we can use pureCSS pure-menu:

menu-horizontal NOT and the hover dropdown

For the hover dropdown, we need -menu-has-children, -menu-allow-hover > -menu-children:

We can also have horizontal scrollable menus with -menu-scrollable:

Last updated