A generic style library for simple projects.
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!
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.
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.
This section demonstrates the styling of typographic and generally static elements.
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 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.
By default, <ul> and <ol> look like this:
To change the marker, edit --list-character variable in your text.css.
<code> looks like this
const message = "<pre> looks like this"
setTimeout(() => {
console.log(message)
}, 7000)
<kbd> looks like this: AltF4, ⌘С, etc.
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.
<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.
<u> behaves basically same as link. Bold underlines work too.
<s> behaves basically same as link and underline. Bold strikethroughs work too.
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.
<abbr> has spaced out letters: HTML.
It is useful to detect them automatically using script.
When title is provided, underline will appear: HTTPS.
<figcaption>
sudo chmod -R 777 /
.framed looks like this.
.bw looks like this 🍕
<hr> looks like this:
.dinkus looks like this:
Here's what forms.css controls.
Default <button> looks like this:
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.
They look like this:
<textarea> look like this:
Notice that horizontal resizing is disabled by default.
<input type="checkbox"> with label looks like this:
<input type="radio"> with label looks like this:
<select> looks like this:
<input type="range"> is unstyled, and with <datalist> it looks like this:
You can also use .vertical ranges:
<input type="file"> reuses button styles:
<fieldset> with <legend> looks like this:
✎ Tip: to align <legend>, use margin instead of text-align.
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> looks like this:
Sadly, indeterminate state is not supported because CSS kills it.
Instead, .spinner is available:
<meter> is not supported either because it's impossible to properly style in Firefox.
After fifteen damn years!
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%;
}
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%
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:
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:
label, :checked, etc.Other than that, I'll be happy to recieve any feedback.
I'm planning to add:
.line inputs;.quiet buttons (no gradient, no press animation);This library is MIT licensed, so you can do whatever you want.
For more info refer to library's repo.