• Stars
    star
    201
  • Rank 194,491 (Top 4 %)
  • Language
    CSS
  • License
    MIT License
  • Created over 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A repository for the development of the HTML5 Boilerplate CSS file, main.css

main.css

A repository for the development of the HTML5 Boilerplate CSS file, style.css.

Historically, the file shipped with HTML5 Boilerplate was called main.css, hence the name of this project. It's since been renamed to style.css. Just in case you were confused.

This project includes both the whole main.css file as well as component files used to generate main.css. This way you can either pull in the whole file, as we do in HTML5 Boilerplate (renaming it to style.css) or you can pull in the individual files as needed.

GitHub Super-Linter

Quick start

Choose one of the following options:

  • Download as part of the latest stable release of HTML5 Boilerplate from html5boilerplate.com.
  • Clone the git repo — git clone https://github.com/h5bp/main.css.git - and checkout the tagged release you'd like to use.
  • Install with npm: npm install main.css and pull in what you need from the resulting node_modules/main.css/distfolder
  • Install with yarn: yarn add main.css and pull in what you need from the resulting node_modules/main.css/distfolder

Features

The project contains the following files, which combine to create the different sections of main.css.

_base.css

Several base styles are included. These styles:

  • provide basic typography settings that improve text readability
  • protect against unwanted text-shadow during text highlighting
  • tweak the default alignment of some elements (e.g.: img, video, fieldset, textarea)

_helpers.css

Along with the base styles, we also provide some commonly used helper classes.

.hidden

The hidden class can be added to any element that you want to hide visually and from screen readers. It could be an element that will be populated and displayed later, or an element you will hide with JavaScript.

.visually-hidden

The visually-hidden class can be added to any element that you want to hide visually, while still have its content accessible to screen readers.

.invisible

The invisible class can be added to any element that you want to hide visually and from screen readers, but without affecting the layout.

As opposed to the hidden class that effectively removes the element from the layout, the invisible class will simply make the element invisible while keeping it in the flow and not affecting the positioning of the surrounding content.

.clearfix

The clearfix class can be added to any element to ensure that it always fully contains its floated children.

Over the years there have been many variants of the clearfix hack, but currently, we use the micro clearfix.

_mqs.css

We include placeholder media queries to help you build up your mobile styles for wider viewports and high-resolution displays. It's recommended that you adapt these media queries based on the content of your site rather than mirroring the fixed dimensions of specific devices.

If you do not want to take the mobile first approach, you can simply edit or remove these placeholder media queries. One possibility would be to work from wide viewports down, and use max-width media queries instead (e.g.: @media only screen and (max-width: 480px)).

_print.css

Lastly, we provide some useful print styles that will optimize the printing process, as well as make the printed pages easier to read.

At printing time, these styles will:

  • strip all background colors, change the font color to black, and remove the text-shadow — done in order to help save printer ink and speed up the printing process

  • underline and expand links to include the URL — done in order to allow users to know where to refer to
    (exceptions to this are: the links that are fragment identifiers, or use the javascript: pseudo protocol)

  • expand abbreviations to include the full description — done in order to allow users to know what the abbreviations stands for

  • provide instructions on how browsers should break the content into pages and on orphans/widows, namely, we instruct supporting browsers that they should:

    • prevent block quotations, preformatted text, images and table rows from being split onto two different pages
    • ensure that headings never appear on a different page than the text they are associated with
    • ensure that orphans and widows do not appear on printed pages

The print styles are included along with the other css to avoid the additional HTTP request. Also, they should always be included last, so that the other styles can be overwritten.

Browser support

We use the following browserlist configuration:

 "browserslist": [
    "> 0.5%",
    "last 2 versions",
    "Firefox ESR",
    "not dead",
    "not IE 11"
  ],

That configuration translates to this full list of browsers.

Contributing

Anyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the guidelines:

License

The code is available under the MIT license.

More Repositories

1

Front-end-Developer-Interview-Questions

A list of helpful front-end related questions you can use to interview potential candidates, test yourself or completely ignore.
Nunjucks
59,382
star
2

html5-boilerplate

A professional front-end template for building fast, robust, and adaptable web apps or sites.
JavaScript
56,323
star
3

server-configs-nginx

Nginx HTTP server boilerplate configs
11,104
star
4

Effeckt.css

This repo is archived. Thanks!
CSS
10,883
star
5

mobile-boilerplate

DEPRECATED - A front-end template that helps you build fast, modern mobile web apps.
ApacheConf
3,861
star
6

server-configs-apache

Apache HTTP server boilerplate configs
Shell
3,193
star
7

server-configs

Boilerplate configurations for various web servers.
3,097
star
8

lazyweb-requests

Get projects and ideas built by the community
1,688
star
9

ant-build-script

Ant build script intended for use with HTML5 Boilerplate. You may find something useful here, but this project is archived.
Shell
985
star
10

html5please

Graded Feature Support: Look up web technologies and find out if they are ready for use.
JavaScript
837
star
11

html5boilerplate.com

Files for the HTML5 Boilerplate website.
HTML
487
star
12

mothereffinganimatedgif

Make your animated gifs in the browser! Oh yeah!
JavaScript
378
star
13

server-configs-node

Express / Connect middleware for websites. Goes well with HTML5 Boilerplate.
JavaScript
342
star
14

server-configs-iis

IIS Web.Config Boilerplates
338
star
15

movethewebforward

Project archived.
JavaScript
284
star
16

create-html5-boilerplate

npx quick start for html5-boilerplate
JavaScript
283
star
17

generator-h5bp

Archived!
JavaScript
239
star
18

generator-server-configs

This project is archived
JavaScript
136
star
19

html5-boilerplate-template

HTML5-Boilerplate Template Repo
CSS
115
star
20

h5bp.github.io

A website for the H5BP organization. Browse all the H5BP projects in one place.
JavaScript
84
star
21

generator-mobile-boilerplate

Scaffolds out H5BP Mobile Boilerplate
JavaScript
76
star
22

server-configs-gae

Google App Engine (GAE) app boilerplate config
62
star
23

server-configs-lighttpd

Lighttpd HTTP server boilerplate configs
55
star
24

html5boilerplate.com-mobile

Deprecated- thanks!
JavaScript
40
star
25

server-configs-test

Tests for HTTP server boilerplate configs
JavaScript
40
star
26

.github

The readme for the @h5bp organization's homepage
4
star