The Boring CSS
An opinionated
BEM
based set of CSS classes to style websites and webapps with bold
NeuBrutalism design, by
RogΓ©rio Taques . It's free and open source.
Version 1.3.0
What it is not?
It's not a framework, does not have a grid system, and it has a very limited number of components. But it is
still very cool π and helps building visually attractive UIs with peace of mind.
If you need a grid system, I recommend
Simple Grid .
Dark-mode ready
Yes! It supports dark mode out of the box! π You just need to add data-mode="dark"
in the
<html />
tag.
Try it here π
Change mode to
Components
Badge
Badge
Badge
Badge
Badge
Badge
Use:
<span class="badge">Badge</span>
Available modifiers:
badge--success
badge--warning
badge--danger
badge--dark
Box
This is a box block.
A box is a container for any kind of content.
Use:
<div class="box">This is a box</div>
Card
A card is like a box, but it can be made with a header + footer , both optional.
Use:
<div class="card">
<div class="card__header">
<h3>This is a card header.</h3>
</div>
<div class="card__body">
<p>This is the card body</p>
</div>
<div class="card__footer">
<a href="#" class="card__link">Link</a>
<a href="#" class="card__link">Link</a>
</div>
</div>
Lists
Unordered list
List item
List item
List item
Ordered list
List item
List item
List item
Use:
<ul>
<li>List item</li>
<li>List item</li>
<li>List item</li>
</ul>
<!-- OR -->
<ol>
<li>List item</li>
<li>List item</li>
<li>List item</li>
</ol>
Tables
User name
Email
Phone
John McLane
mclane@diehard.movie
1 234 5678 900
Luke Skywalker
l.skywalker@startwars.movie
123 4567 8901
Tony Stark
tony@starkindustries.movie
12 3456 7890
Use:
<table>
<thead>
<tr>
<th>User name</th>
<th>Email</th>
<th>Phone</th>
</tr>
</thead>
<tbody>
<tr>
<td>John McLane</td>
<td>mclane@diehard.moviee</td>
<td>1 234 5678 900</td>
</tr>
<!-- ... -->
</tbody>
</table>
Notifications
This is a notification block.
This is a success notification block.
This is a warning notification block.
This is an error notification block.
This is an info notification block.
Use:
<div class="notification">
This is a notification block.
</div>
Available modifiers:
notification--success
notification--warning
notification--error
notification--info
Code
This is how the content of a <code />
tag looks like.
Pre
<pre>
<!-- Code here -->
</pre>
Progress
1%
50%
75%
Use:
<div class="progress progress--75">75%</div>
Available modifiers for progress:
progress--<number>
E.g. progress--5
E.g. progress--75
E.g. progress--100
E.g. progress--infinite
Available modifiers for colors:
progress--warning
progress--danger
progress--info
progress--dark
Javascript
Although you are not required to use Javascript with
Boring CSS at all, you might want to use it to enhance the user experience (UX) of your website or web
apps, for example, to give users the ability to change the color theme, or open/close a modal, etc.
Light-Dark mode switcher
The simple Javascript code bellow toggles the
data-mode
attribute of the <html />
tag on a button (or trigger) click. Use
it freely.
<script>
const trigger = document.querySelector('[role="toggle"].theme-switcher');
const html = document.querySelector('html');
if (trigger) {
trigger.addEventListener('click', () => {
const mode = html.getAttribute('data-mode');
html.setAttribute('data-mode', mode === 'dark' ? 'light' : 'dark');
});
}
</script>
E.g. π
Change mode to
You may want to use the
The Boring JavaScript , a small and simple JavaScript library to help you with some common tasks, like toggling the theme.