A modern, responsive CSS boilerplate library to kickstart any web-based project.

Related tags

CSS peacock-css
Overview

Peacock CSS

Peacock is a modern, responsive CSS boilerplate library to kickstart any web-based project.

It is simple, lightweight and it contains all the basic components required to build a modern web page.

Inspired by Skeleton CSS

Compatible with Normalize.css

Installation

You can use jsDelivr to link Peacock CSS into your project:

https://cdn.jsdelivr.net/gh/binarybirds/[email protected]/peacock.min.css

Just use a standard HTML link tag to link the library as an external stylesheet.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Demo</title>
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/binarybirds/[email protected]/peacock.min.css">
</head>
<body>
    <main>
        <h1>Hello world!</h1>
        <p>This is a simple Peacock CSS demo.</p>
    </main>
</body>
</html>

You should always use the minified version and it is also recommended to use a CDN server.

Breakpoints

Peacock CSS follows the conventions described in the following article:

The 100% correct way to do CSS breakpoints

These are the screen sizes:

  • 0-599 - extra small
  • 600-899 - small
  • 900-1199 - normal
  • 1200-1799 - large
  • 1800+ - extra large

Peacock CSS follows a mobile-first design approach and uses the following media queries.

/* general style comes here (mobile first) */

@media screen and (max-width: 599px) {   
    /* extra small device screens only < 600 */
}
@media screen and (min-width: 600px) {
    /* small device screens: 600-899 */
}
@media screen and (min-width: 900px) {
    /* "normal" device screens: 900-1199 */ 
}
@media screen and (min-width: 1200px) {
    /* large device screens: 1200-1799 */ 
}
@media screen and (min-width: 1800px) {
    /* extra large device screens: 1800+ */ 
}

If you want to extend or update various styles, you should use these media queries to define the exact same breakpoints.

Color schemes

Peacock CSS supports multiple color schemes.

  • Light
  • Dark

You can use the following media query to define your own styles:

/* light mode */
@media (prefers-color-scheme: dark) {
    /* dark mode */
}

Everything you create with Peacock CSS will work for both interface styles (light mode and dark mode).

Variants

Almost every class available in Peacock CSS has style variants. This is a very important context, every selector that has a variant uses a suffix, separated by a dash character (e.g. margin-[variant]). The following variant suffixes are available:

  • Extra large (-xl)
  • Large (-l)
  • Normal (no suffix)
  • Small (-s)
  • Extra small (-xs)

In some cases there are some other "special" variants available:

  • Full (-full)
  • Auto (-auto)
  • Zero (-zero)

Now if you need to setup a margin for example, you can use the margin-top-xl class to add an extra large margin.

Typography

Peacock CSS uses the built-in system fonts based on your operating system. It uses rem values to support user-defined font sizes and the default line-height is slightly increased to support a better reading experience. Content containers and font sizes are automatically calculated to improve readability.

html {
    font-size: 1rem;
}
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.5rem;
}

If you want to use a custom font, you should override the font-family property on the body selector. Also if you want to change the font-size, please use the html selector (combined with media queries) if necessary.

Headings

The following heading sizes are styled in Peacock CSS:

  • h1
  • h2
  • h3
  • h4
  • h5
  • h6

Paragraphs

The paragraph style is also available through the p class.

<span class="p">This looks like a paragraph</span>

Here's a quick example with headings and stuff:

<h1>Title</h1>

<h2>Subtitle</h2>
<p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies. Cras imperdiet ligula eu eros faucibus cursus. Quisque aliquam suscipit justo a sollicitudin. Sed vitae purus erat. Vivamus bibendum vel leo at hendrerit. Pellentesque auctor at nisi non tempor. Suspendisse eget posuere libero. Quisque interdum nunc non turpis lobortis hendrerit. Integer maximus varius metus nec tempor. Duis volutpat ligula eu elementum imperdiet. Nunc elit libero, hendrerit ornare fermentum id, ultricies eu quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

<h3>Other sub-sub-title</h3>
<p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies. Cras imperdiet ligula eu eros faucibus cursus. Quisque aliquam suscipit justo a sollicitudin. Sed vitae purus erat. Vivamus bibendum vel leo at hendrerit. Pellentesque auctor at nisi non tempor. Suspendisse eget posuere libero. Quisque interdum nunc non turpis lobortis hendrerit. Integer maximus varius metus nec tempor. Duis volutpat ligula eu elementum imperdiet. Nunc elit libero, hendrerit ornare fermentum id, ultricies eu quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

You put this entire code in a container element to automatically use the best available space to improve readability.

Text align

You can align text related content with the help of the following three classes.

  • text-align-center
  • text-align-left
  • text-align-right

Justified text is not supported out of the box, because in 90% of the cases people don't use proper hyphenation, so justified text looks real bad.

Layout

Containers

  • lead - lead element for displaying a separate h1 and p element
  • container - preferred container size for reading textual content (responsive)

It is really simple to create a container element.

<div class="lead">
    <h1>Title</h1>
    <p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. </p>
</div>

<div class="container">
	<h2>Subtitle</h2>

	<p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies. Cras imperdiet ligula eu eros faucibus cursus. Quisque aliquam suscipit justo a sollicitudin. Sed vitae purus erat. Vivamus bibendum vel leo at hendrerit. Pellentesque auctor at nisi non tempor. Suspendisse eget posuere libero. Quisque interdum nunc non turpis lobortis hendrerit. Integer maximus varius metus nec tempor. Duis volutpat ligula eu elementum imperdiet. Nunc elit libero, hendrerit ornare fermentum id, ultricies eu quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

	<h3>Other sub-sub-title</h3>
	<p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies. Cras imperdiet ligula eu eros faucibus cursus. Quisque aliquam suscipit justo a sollicitudin. Sed vitae purus erat. Vivamus bibendum vel leo at hendrerit. Pellentesque auctor at nisi non tempor. Suspendisse eget posuere libero. Quisque interdum nunc non turpis lobortis hendrerit. Integer maximus varius metus nec tempor. Duis volutpat ligula eu elementum imperdiet. Nunc elit libero, hendrerit ornare fermentum id, ultricies eu quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>

The container used in the snippet above will scale based on your screen size. The content inside of it will be positioned in the middle of the screen.

Grid

Grids are responsive by default. The Desktop-Tablet-Mobile (DTM) system allows you to specify grid variants based on how many columns you want for each size. Of course you can choose a fixed column size grid, but usually that's not the case you want. Here's a list of available grids:

Fixed colum grids

  • grid-2
  • grid-3
  • grid-4
  • grid-5
  • grid-6
  • grid-9

The number suffix represents the number of columns on every screen.

DTM grids

2-column-based responsive grids:

  • grid-221 - 2 columns on desktop, tablet, 1 column on mobile screens

3-column-based responsive grids:

  • grid-321 - 3 columns on desktop, 2 column on tablet, 1 column on mobile screens

4-column-based responsive grids:

  • grid-421 - 4 columns on desktop, 2 columns on tablet, 1 column on mobile screens

The most common use-case is a 321 grid. Here's a quick feature box example:

<div class="grid-321">
    <div>
        <span class="icon">๐Ÿฆš</span>
        <h3>Feature</h3>
        <p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies.</p>
    </div>
    <div>
        <span class="icon">๐Ÿฆš</span>
        <h3>Feature</h3>
        <p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies.</p>
    </div>
    <div>
        <span class="icon">๐Ÿฆš</span>
        <h3>Feature</h3>
        <p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies.</p>
    </div>
    <div>
        <span class="icon">๐Ÿฆš</span>
        <h3>Feature</h3>
        <p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies.</p>
    </div>
    <div>
        <span class="icon">๐Ÿฆš</span>
        <h3>Feature</h3>
        <p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies.</p>
    </div>
    <div>
        <span class="icon">๐Ÿฆš</span>
        <h3>Feature</h3>
        <p>Suspendisse sit amet ante scelerisque, cursus arcu eu, consequat ex. Nullam euismod eros in consequat ultricies.</p>
    </div>
</div>

The grid column span is 1 for every child element inside the grid. You can override this behavior with the column gap and row gap as well.

Dividing grids

It is possible to place a responsive grid inside another grid, so if you need more columns feel free to combine them.

Table

Tables rows are displayed as grids in Peacock CSS. It is possible to override the layout of a table row through grid classes.

<table>
	<thead>
	    <tr class="grid-321">
	        <td>1</td>
	        <td>2</td>
	        <td>3</td>
	    </tr>
	</thead>
	<tbody>
	    <tr class="grid-321">
	        <td>a</td>
	        <td>b</td>
	        <td>c</td>
	        
	    </tr>
	    <tr class="grid-321">
	        <td>d</td>
	        <td>e</td>
	        <td>f</td>
	        
	    </tr>
	</tbody>
</table>

You can use different grid classes for each row. Alternatively you can set the grid layout on the table row elements explicitly by using the grid-column-template property.

Spacing and sizing

Space

You can use the following CSS variables to setup a consistent spacing structure:

--space-4xl: 4.5rem;
--space-3xl: 3rem;
--space-2xl: 2.5rem;
--space-xl: 2rem;
--space-l: 1.75rem;
--space: 1.5rem;
--space-s: 1rem;
--space-xs: 0.75rem;
--space-2xs: 0.5rem;
--space-3xs: 0.25rem;
--space-4xs: 0.125rem;

Font size

You can use the following CSS variables to explicitly set font sizes:

--font-size-4xl: 2.5rem;
--font-size-3xl: 1.75rem;
--font-size-2xl: 1.5rem;
--font-size-xl: 1.25rem;
--font-size-l: 1.125rem;
--font-size: 1rem;
--font-size-s: 0.875rem;
--font-size-xs: 0.75rem;
--font-size-2xs: 0.5rem;

Form elements

Form element styles are rewritten from scratch, you can use the following elements without any extra CSS code.

Buttons

Documentation is coming soon.

<input type="submit" value="Submit">

<input type="reset" value="Reset">

<button>Submit form</button>

<a href="#" class="button">Lorem ipsum</a>

Input

Documentation is coming soon.

<input type="text" placeholder="Email address">

Textarea

Documentation is coming soon.

<textarea placeholder="Hello world"></textarea>

Sizes

  • xl
  • l
  • normal (without suffix)
  • s
  • xs
<textarea class="xl" placeholder="Hello world"></textarea>

Radio

Documentation is coming soon.

<input type="radio"><label>Lorem ipsum</label><br>

Checkbox

Documentation is coming soon.

<input type="checkbox"><label>Lorem ipsum</label><br>

Select

Documentation is coming soon.

<select>
  <option>Lorem ipsum 1</option>
  <option>Lorem ipsum 2</option>
  <option>Lorem ipsum 3</option>
  <option>Lorem ipsum 4</option>
</select>

Multiple

<select multiple="multiple">
  <option>Lorem ipsum 1</option>
  <option>Lorem ipsum 2</option>
  <option>Lorem ipsum 3</option>
  <option>Lorem ipsum 4</option>
</select>

Fieldset

Documentation is coming soon.

<fieldset>
  <legend>Lorem ipsum</legend>
</fieldset>

Colors

Peacock CSS defines colors based on the Color - Human Interface Guide document created by Apple.

Colors may vary based on your interface color scheme (light mode, dark mode).

The color proprety always refers to the foreground color of an element, the background class will set the background color value.

Site colors

There are 4 major site color variables available to use:

  • --color
  • --color-1
  • --color-2
  • --color-3

Background colors

The following background color values are available to use:

  • --bg-color
  • --bg-color-1
  • --bg-color-2
  • --bg-color-3
  • --bg-color-4

Background colors

The following text color values are available to use:

  • --text-color
  • --text-color-1
  • --text-color-2
  • --text-color-3

Other colors

The following color values are available for both light and dark mode with a slight difference (white and black are always white and black).

  • --white-color
  • --black-color
  • --blue-color
  • --green-color
  • --indigo-color
  • --orange-color
  • --pink-color
  • --purple-color
  • --red-color
  • --teal-color
  • --yellow-color
  • --brown-color
  • --gray-color

Utilities

Menu

Peacock CSS provides a responsive CSS only hamburger menu and a secondary option menu by default.

<div id="navigation">
    <a id="site-logo" href="">
        <img src="/images/logo.png">
    </a>
    
    <nav id="primary-menu">
        <input type="checkbox" id="primary-menu-button" name="menu-button" class="menu-button">
        <label for="primary-menu-button">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <line x1="3" y1="12" x2="21" y2="12"></line>
                <line x1="3" y1="6" x2="21" y2="6"></line>
                <line x1="3" y1="18" x2="21" y2="18"></line>
            </svg>
        </label>
        <div class="menu-items">
            <a href="" class="selected">Lorem</a>
            <a href="">Ipsum</a>
            <a href="">Dolor</a>
            <a href="">Sit</a>
            <a href="">Amet</a>
        </div>
    </nav>

    <nav id="secondary-menu">
        <input type="checkbox" id="secondary-menu-button" name="menu-button" class="menu-button">
        <label for="secondary-menu-button">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <circle cx="12" cy="12" r="1"></circle>
                <circle cx="12" cy="5" r="1"></circle>
                <circle cx="12" cy="19" r="1"></circle>
            </svg>
        </label>
        <div class="menu-items right">
            <a href="#">My account</a>
            <a href="/">Logout</a>
        </div>
    </nav>
</div>

You can use the following HTML code to create a new menu.

Selection

It is possible to display the selection from an element by using the selection-off class.

You might also like...

A classless CSS framework to write modern websites using only HTML.

new.css new.css A classless CSS framework to write modern websites using only HTML. It weighs 4.8kb. All it does is set some sensible defaults and sty

Jan 3, 2023

A modern alternative to CSS resets

normalize.css A modern alternative to CSS resets NPM npm install --save normalize.css CDN See https://yarnpkg.com/en/package/normalize.css Download Se

Jan 5, 2023

A tiny modern CSS reset

minireset.css A tiny modern CSS reset that covers the basics: resets the font sizes: so that using semantic markup doesn't affect the styling resets t

Dec 29, 2022

๐Ÿšฟ A modern CSS reset

๐Ÿšฟ A modern CSS reset

Modern CSS reset Installation npm install --save ress or bower install --save ress Features Apply box-sizing: border-box; in all elements. Reset paddi

Jan 4, 2023

A modern alternative to CSS resets

A modern alternative to CSS resets

A modern alternative to CSS resets

Jan 1, 2023

Low-level CSS Toolkit โ€“ the original Functional/Utility/Atomic CSS library

Basscss Low-level CSS toolkit โ€“ the original Functional CSS library https://basscss.com Lightning-Fast Modular CSS with No Side Effects Basscss is a l

Dec 31, 2022

Cooltipz.css - A highly customisable, minimal, pure CSS tooltip library

Cooltipz.css - A highly customisable, minimal, pure CSS tooltip library

Cooltipz.css - Cool tooltips Cool customisable tooltips made from pure CSS Lightweight โ€ข Accessible โ€ข Customisable โ€ข Simple Cooltipz.css is a pure CSS

Dec 24, 2022

micro-library for CSS Flexbox and CSS Grid

SpeedGrid micro-library for CSS Flexbox and CSS Grid Overview SpeedGrid dynamically generates inline CSS by specifying the class name. Easy maintenanc

Mar 26, 2022

Text-based user interface CSS library

Text-based user interface CSS library

TuiCss Text-based user interface CSS library -- Documentation -- About TuiCss is a library focused to create web applications using an interface based

Jan 2, 2023
Releases(1.0.0-beta.5)
Owner
Binary Birds
Binary Birds
Spectre.css - A Lightweight, Responsive and Modern CSS Framework

Spectre.css Spectre.css is a lightweight, responsive and modern CSS framework. Lightweight (~10KB gzipped) starting point for your projects Flexbox-ba

Yan Zhu 11.1k Jan 8, 2023
A set of small, responsive CSS modules that you can use in every web project.

Pure A set of small, responsive CSS modules that you can use in every web project. http://purecss.io/ This project is looking for maintainers to suppo

Pure CSS 22.7k Jan 3, 2023
Skeleton: A Dead Simple, Responsive Boilerplate for Mobile-Friendly Development

Skeleton Skeleton is a simple, responsive boilerplate to kickstart any responsive project. Check out http://getskeleton.com for documentation and deta

Dave Gamache 18.8k Dec 29, 2022
CSS Boilerplate / Starter Kit: Collection of best-practice CSS selectors

Natural Selection Natural Selection is a CSS framework without any styling at all. It is just a collection of selectors that can be used to define glo

FrontAid CMS 104 Dec 8, 2022
The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.

Install | Documentation | Releases | Contributing Foundation is the most advanced responsive front-end framework in the world. Quickly go from prototy

Foundation 29.4k Jan 4, 2023
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

Bootstrap Sleek, intuitive, and powerful front-end framework for faster and easier web development. Explore Bootstrap docs ยป Report bug ยท Request feat

Bootstrap 161k Jan 1, 2023
Modern CSS framework based on Flexbox

Bulma Bulma is a modern CSS framework based on Flexbox. Quick install Bulma is constantly in development! Try it out now: NPM npm install bulma or Yar

Jeremy Thomas 46.6k Dec 31, 2022
A bare-bones CSS reset for modern web development.

A modern CSS reset A tiny little reset that you can use as the basis of your CSS projects. You can read a breakdown of it here. Installation NPM: npm

Andy Bell 2.7k Jan 1, 2023
Reseter.css - A Futuristic CSS Reset / CSS Normalizer

Reseter.css A CSS Reset/Normalizer Reseter.css is an awesome CSS reset for a website. It is a great tool for any web designer. Reseter.css resets all

Krish Dev DB 1.1k Jan 2, 2023
A responsive HTML template for coding projects with a clean, user friendly design. Crafted with the latest web technologies, the template is suitable for landing pages and documentations.

Scribbler - a responsive HTML template for coding projects and documentations Scribbler is a responsive HTML/CSS/Javascript template designed for deve

Amie Chen 394 Jan 1, 2023