Boring CSS

A generic style library for simple projects.

Introduction

This library is a lightweight CSS toolkit for quick styling of small user interfaces. It avoids enforcing any specific trendy design choices and does not attempts to be a complex UI framework. Instead, it's just a collection of basic styles for common HTML elements.

Don't be afraid to customize it. In fact, I encourage you to do so!

Installation

It's simple. Just download these files need and import them into your project however you prefer:

Or just download the repository.

Styles are split between files just to make editing easier. This library isn't actually modular. In production you should consider bundling it all into a single file.

Demo

Below you'll find all the components available. To see the code, just inspect the source code of the section in your browser.

Source code is also available on Github.

Text

This section demonstrates the styling of typographic and generally static elements.

Headings and Paragraphs

Styles of text and headings heavily relies on your desired structure of page, and you will probably have to edit these styles. On this site, only three levels of headings are used.

Aside from classic heading tags, you can use .h1.h6 classes.

Text colors

Text can be colored with classes:

.text-blue .text-red .text-green .text-purple .text-yellow .text-orange .text-black .text-white

In dark theme black and white are reversed.

Lists

By default, <ul> and <ol> look like this:

Unordered list:
  • Pulp Fiction;
  • Reservoir Dogs;
  • Kill Bill;
  • Hateful Eight;
  • Once Upon a Time in Hollywood;
  • Django Unchained;
  • Inglourious Basterds.
Ordered list:
  1. Get up;
  2. Have breakfast;
  3. Watch TV;
  4. Have a dinner;
  5. Take a nap;
  6. Watch TV;
  7. Go to bed.

To change the marker, edit --list-character variable in your text.css.

Code

<code> looks like this

const message = "<pre> looks like this"
setTimeout(() => {
  console.log(message)
}, 7000)

Keybind

<kbd> looks like this: AltF4, С, etc.

Table

Default table:

Name Age Address Franchise
Alucard 500s Hellsing Manor, UK Hellsing
Sherlock Holmes 34 221B Baker Street, London, UK Sherlock Holmes
Winnie the Pooh 3 Hundred Acre Wood Winnie the Pooh

.bordered table:

Name Age Address Franchise
Alucard 500s Hellsing Manor Hellsing
Sherlock Holmes 34 221B Baker Street, London, UK Sherlock Holmes
Winnie the Pooh 3 Hundred Acre Wood Winnie the Pooh

.compact tables:

Name Age Address Franchise
Alucard 500s Hellsing Manor Hellsing
Sherlock Holmes 34 221B Baker Street, London, UK Sherlock Holmes
Winnie the Pooh 3 Hundred Acre Wood Winnie the Pooh
Name Age Address Franchise
Alucard 500s Hellsing Manor Hellsing
Sherlock Holmes 34 221B Baker Street, London, UK Sherlock Holmes
Winnie the Pooh 3 Hundred Acre Wood Winnie the Pooh

All four tables above use .hanging to align the first column with the left margin.

Image

Images are responsive, just as you would expect. I also made them block elements instead of inline.

Quote

<blockquote> with a <cite> looks like this:

Wikipedia is the best thing ever. Anyone in the world can write anything they want about any subject so you know you are getting the best possible information.

— Michael Scott, from the 18th episode of the 3rd season of The Office

.link looks like this. Links with <strong> and <b> inside them have thick underline.

Notice that <a> tag itself is not styled.

Underline

<u> behaves basically same as link. Bold underlines work too.

Strikethrough

<s> behaves basically same as link and underline. Bold strikethroughs work too.

Marked text

Using <mark> to highlight text will look like this.

Marked text inside <i> will have skewed background. But note that if you're using your own font, you'll have to adjust CSS to match it's italic version.

Abbreviation

<abbr> has spaced out letters: HTML. It is useful to detect them automatically using script.

When title is provided, underline will appear: HTTPS.

Figure and caption

some thing idk
Figure above is captioned with <figcaption>
sudo chmod -R 777 /
You can caption anything: media, tables, text, etc.
Placing caption above works too
αβγδεζηθικλμνξοπρστυφχψω

Framed

.framed looks like this.

Black and white

.bw looks like this 🍕

Separators

<hr> looks like this:


.dinkus looks like this:

Interactive Elements

Here's what forms.css controls.

Button

Default <button> looks like this:

Always clarify why something is disabled!

If you want to fool around a bit, you can use colored buttons, using .{color} and .text-{color} classes:


To get wide buttons, add .block:


To scale buttons, just use font-size CSS property:


Note that buttons made with <input type="button|reset|submit"> are not styled. If you need them, just edit the selectors.

Inputs

They look like this:

Textarea

<textarea> look like this:

Notice that horizontal resizing is disabled by default.

Checkbox

<input type="checkbox"> with label looks like this:

Radio

<input type="radio"> with label looks like this:

Select

<select> looks like this:

Range

<input type="range"> is unstyled, and with <datalist> it looks like this:

You can also use .vertical ranges:

File

<input type="file"> reuses button styles:

Fieldset

<fieldset> with <legend> looks like this:

Look! Do you like it?
Can I nest it?
What do you think?

Tip: to align <legend>, use margin instead of text-align.

Details

This is an accordion (e.g. collapsible). Use it wisely!

Accordions are extremely annoying. They’re generally considered bad UX and can be an accessibility nightmare — especially when they are inside forms. This library does include a minimal style for them, but honestly, I wouldn’t recommend using them. There’s almost always a better solution, so think twice before resorting to <details>.

Progress

<progress> looks like this:

Sadly, indeterminate state is not supported because CSS kills it. Instead, .spinner is available:

Deleting C:\Users\dima\dev\boringcss...

<meter> is not supported either because it's impossible to properly style in Firefox. After fifteen damn years!

Font

This page uses the Commissioner font by Kostas Bartsokas. Its metrics are uneven, so to vertically center text by uppercase characters, these overrides are applied:

@font-face { ...
  ascent-override: 96.3%;
  descent-override: 25%;
}
K
Perfectly centered
K
Not centered (most fonts)

The values are calculated by balancing the space above and below uppercase letters, where descent is 25% of the em size. Key formula is:

D = your desired descent
ascentOverride = (capHeight + D) / unitsPerEm × 100%
descentOverride = D / unitsPerEm × 100%

For Commissioner it would be:

D = 500
capHeight = 1426
unitsPerEm = 2000
ascentOverride = (1426 + 500) / 2000 × 100% = 96.3%
descentOverride = 500 / 2000 × 100% = 25%

Overrides calculator (β)

If you want to use a different font, you can use the calculator below.

Step 1: Go to Capsize, pick or upload your font, and copy its metrics in JSON here:

Step 2: Add the lines below into your @font-face

ascent-override: 
descent-override:

Feedback

If you have a suggestion or found a bug, please open an issue or email me.

Before suggesting a change, please note that components must not require:

Other than that, I'll be happy to recieve any feedback.

Future plans

I'm planning to add:

Licensing Stuff

This library is MIT licensed, so you can do whatever you want.

For more info refer to library's repo.