flat.css

Write some HTML5, add flat.css, everything looks nice aligns easily, supports validation. Almost no classes to learn easy to build on top of, and no javascript.

Or build all your styles on top. flat.css does not give you any fancy widgets, it just styles every HTML5 element and makes it flow on the page without any fuss. You don't need to learn a lot of classes everything else is automatic when you install. Amongst other things you get carefully aligned form controls, semantically correct colouring with accessible contrast, validation hints on form controls and cross-browser consistency.

Installation

Add <link href="https://unpkg.com/flatcss@2.0.8/flat.css" rel="stylesheet" type="text/css" media="screen"> to your page.

Semantic Tags

All HTML5 tags are styled learn them and use them.

Examples of styling.

Heading

Your text may use emphasis, or be stronger. You may strikethrough, underline or highlight it. You may want to indicate inserted or deleted text. Show code or keyboard entry, subscript or superscript.

You may start another paragraph and include an image.

Example image, the moon

An image on a link will hightlight as you hover over it like this one. Example image, the moon

Links try to be on one line even if they are long like this one.

You may have a block quote to show.

Use some lists

  • Unordered list item 1
  • Unordered list item 2
  1. Ordered list item 1
  2. Ordered list item 2
Definition list title 1
This is the first definition
Definition list title 2
This is the second definition

Use Tables

Here is an example table.

a table
Heading 1 Heading 2 Heading 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
Cell 7 Cell 8 Cell 9

Buttons

Buttons align correctly next to text and other buttons, no matter what type of button.

Only one class is supplied with flat.css, apply class="button" to an <a> tag (or virtually any other tag) to make it appear as a button.

Buttons in line with text.

Text text Link Button text.

Buttons have different colours for submit, reset and disabled.

Different button states.

Buttons size can be adjusted by altering the font size. Either by setting the wrapping with a <small> tag; or you can alter the font-size in your stylesheet.

Different sized buttons beside text.
text text

Forms

All HTML form tags are styled to look fairly similar cross browser. All will sit neatly aligned when next to each other.

Form elements in one line.

To layout forms in other ways use <div> tag to separate elements, or simply extend with your own stylesheet.

Arranged form elements.

Anything else?

flat.css is all about making the best of HTML5 without using javascript; there is nothing else really. This allows you to include this stylesheet in any project no matter what scripting framework you use - there is no need to add a framework specific module for flat.css. If you need grids, icons, more complex controls make or find your own. This project aims to style HTML elements only.

The most common HTML5 components are listed on this page. The test pages below have all of the others tags in many combinations.

Some other classes exist too:

flat.css is easily extended, suggestions welcome.

Acknowledgments