A CSS framework built for creative and beautifully designed websites.
Makr.css is based off of the custom CSS I creted for my own personal website (embeemedialab.com). I needed a solid layout and easily tunable components since I change te design of my website annually (Somtimes subtle changes sometimes drastic). I eventually started building my client websites using the basic framework I created, and customizing the look and feel on top of it. Makr.css is the result from years of fine tuning the css to make it easy to implement and fast at getting to the fun part of designing websites.
It all started from my three stylesheets:
helper.css A plain layout grid with all the adjustment classes you could ever want.
mbm.styles.css Component and select typograph styles and overides.
editions.css The almost annually added, new styled components and ideas.
From these files I standardized class names and consolidated styles to be easy to find and customize. To make it something that can be used on any project and become a part of every stacks process I added:
- CSS variables for everything. Colors, fonts, type scale, spacing, radius and shadows.
- Fluid, responsive typography. It scales smoothly from 320px to 1440px. Change 4 numbers to re-tune the whole scale.
- Light and dark themes. Plus an MBM preset that recreates my current site's look.
- The same grid class names as before (
row,col-md-6,offset-lg-2…), with working gutters. - Layout primitives (
auto-grid,with-sidebar,switcher,stack,cluster). These handle most layouts with one class and no breakpoints. - Cascade layers. Every new projects custom CSS always wins without needing to use
!important. - Versioned releases. Each one is frozen in
releases/vX.Y.Z/and tagged in git. So each project can live on as it is.
- Copy
dist/makr.min.css(and optionallydist/makr.js) into the site, e.g.public/css/. Or pin a version:releases/v2.0.0/makr.min.css. - Copy
templates/site.csstopublic/css/site.css. - In your layout:
<html lang="en" data-theme="light"> <!-- light | dark | auto -->
<head>
<link rel="stylesheet" href="/css/makr.min.css">
<link rel="stylesheet" href="/css/site.css">
</head>
…
<script src="/css/makr.js" defer></script> <!-- only if you use .tabs -->- In
site.css, uncomment and change the variables you need. That's it, with no build step.
:root {
--color-primary: #0f766e;
--font-heading: "Fraunces", Georgia, serif;
--type-ratio-max: 1.333; /* more dramatic headings */
--btn-radius: var(--radius-full);
}<html lang="en" data-theme="dark">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Urbanist:wght@300;400;500;700;800&display=swap">
<link rel="stylesheet" href="/css/makr.min.css">
<link rel="stylesheet" href="/css/presets/mbm.min.css">Also load dist/makr-legacy.min.css. Old classes like padding-top-sm-35,
bg-white-accent-5, hide-from-md and text-center-from-lg keep working, with their original breakpoints.
| Path | What it is |
|---|---|
dist/ |
Use these. Built CSS and JS for the current version |
releases/vX.Y.Z/ |
Frozen copy of every release. Never edited, so sites can pin a version |
src/settings/tokens.css |
Every design variable, with comments |
src/settings/themes.css |
Dark theme + auto (follows OS setting) |
src/base/ |
Reset, element styles, typography |
src/layout/layout.css |
Containers, sections, grid base, layout primitives |
src/components/ |
Buttons, forms, tables, heading, cards, badges/alerts, accordion, tabs |
src/utilities/utilities.css |
Colors, borders, type, sizing, effects |
src/generated/ |
Grid columns and responsive utilities. Generated, don't edit |
presets/ |
Brand presets (mbm.css) |
addons/ |
legacy.css (old class names), makr.js (tabs/accordion helper) |
templates/site.css |
Starter override file for a new project |
demo/index.html |
Kitchen sink. Open it in a browser to see everything (light/dark/MBM) |
framework.config.mjs |
Breakpoints, columns, which responsive utilities to generate |
css-start/ |
The original three files, for reference |
| Name | Min width | Typical device |
|---|---|---|
| (none) | 0 | phones |
sm |
576px | large phones |
md |
768px | tablets |
lg |
1024px | landscape tablets / laptops |
xl |
1280px | desktops |
xxl |
1440px | large desktops |
These are mobile-first. col-md-6 means "half width from 768px up".
Media queries can't use CSS variables, so breakpoints live in framework.config.mjs. Change them there and run npm run build.
The scale is generated by CSS from six variables (see tokens.css):
| Variable | Default | Meaning |
|---|---|---|
--type-base-min |
1 (16px) |
body size on phones |
--type-base-max |
1.125 (18px) |
body size on desktop |
--type-ratio-min |
1.175 |
step ratio on phones |
--type-ratio-max |
1.25 |
step ratio on desktop |
--type-vw-min / --type-vw-max |
20 / 90 (rem) |
fluid range: 320px to 1440px |
That produces --step--2 … --step-7, also named --text-xs … --text-6xl.
Headings use --h1-size … --h6-size. Point any of them at a different step.
| Element | Phone (375px) | Desktop (1440px) |
|---|---|---|
| h1 | ~37px | ~55px |
| h2 | ~31px | ~44px |
| h3 | ~26px | ~35px |
| body | 16px | 18px |
Classes: .h1–.h6, .display-1–.display-3, .lead, .eyebrow, .small,
.fs-xs … .fs-6xl, .prose (for CMS content), .flow (even spacing between children).
One unit drives everything: --space-unit: 0.25rem.
| Key | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| px | 0 | 4 | 8 | 12 | 16 | 24 | 32 | 40 | 48 | 64 | 80 | 96 | 128 |
Utilities: m-*, mt-*, mb-*, ml-*, mr-*, mx-*, my-*, plus the same set for padding (p-* etc.) and gap-*.
Responsive variants: mt-md-6, px-lg-8. By default they're generated for md and lg only. To get sm/xl/xxl too, set responsive.spacing: true in the config.
Sections: .section, .section-sm, .section-lg use fluid vertical padding.
<!-- Grid: same as before -->
<div class="container">
<div class="row g-6">
<div class="col-md-6 col-lg-4">…</div>
</div>
</div>
<!-- Cards that reflow on their own -->
<div class="auto-grid" style="--auto-grid-min: 18rem">…</div>
<!-- Sidebar + content that stacks when narrow -->
<div class="with-sidebar"><aside>…</aside><main>…</main></div>| Class | Use |
|---|---|
.container / .container-narrow / .container-wide / .container-fluid |
page width (.wrap is an alias of .container) |
.row + .col-*, .offset-*, .order-*, .row-cols-* |
12-column grid |
.g-*, .gx-*, .gy-* |
gutters (.no-gutters still works) |
.auto-grid |
responsive card grid, no breakpoints |
.with-sidebar (.sidebar-right) |
sidebar layout |
.switcher |
side-by-side until narrow, then all stack together |
.stack / .cluster / .split / .center |
vertical rhythm / wrapping row / two ends / centered column |
.full-bleed |
break out of the container to the screen edges |
Buttons (.btn + -primary/-secondary/-accent/-light/-dark/-outline/-primary-outline/-ghost/-link, plus -sm/-lg/-pill/-round/-block).
Forms (.form-control, .form-select, .form-check, .form-switch, .input-group).
Tables (.table, -striped, -hover, -bordered, -sm, .table-responsive).
Section heading (.heading + -sm/-lg/-xlg/-xxlg/-center/-stroke).
Cards (.card, -hover, -outline, -glass).
Badges, tags and alerts. Accordion (<details> or old markup). Tabs.
Every button variant is just local variables, so a new one is a few lines:
.btn-brand { --btn-bg: #6d28d9; --btn-color: #fff; --btn-hover-bg: #5b21b6; }<html data-theme="dark"> <!-- whole site dark -->
<html data-theme="auto"> <!-- follow the visitor's OS -->
<section data-theme="dark"> <!-- one dark band on a light page -->The framework uses semantic versioning:
- patch
1.0.1: bug fixes, no visual change to existing markup - minor
1.1.0: new classes/components, nothing removed - major
2.0.0: renamed/removed classes or changed defaults that could change how a site looks
# 1. make your changes in src/, check demo/index.html
npm version minor --no-git-tag-version # bumps package.json (patch | minor | major)
npm run release # builds dist/ and freezes releases/v1.1.0/
# 2. add an entry to CHANGELOG.md
git add -A
git commit -m "Release v1.1.0"
git tag v1.1.0
git push && git push --tags # if you've connected a GitHub remotenpm run release refuses to overwrite an existing version folder, so a released version can never change under a live site.
- Pinned (recommended): copy
releases/v2.0.0/makr.min.cssinto the site. Upgrading is a deliberate choice. - Latest: copy
dist/makr.min.css.
Requirements: Node 18+. There are no npm dependencies, so npm install isn't needed.
| Command | Does |
|---|---|
npm run build |
regenerate grid/utilities from the config, bundle and minify into dist/ |
npm run release |
build, then copy dist/ to releases/v<version>/ |
npm run legacy |
rebuild addons/legacy.css from css-start/helper.min.css |
While developing you can also link src/makr.css directly. Browsers understand its @import … layer() lines natively.
- Grid gutters were switched off.
[class*="col-"]{padding:0}meant gutters only applied to an unusedtt-col-prefix. .text-lg–.text-xxxlgnever worked.calc(100%+0.2vw)is invalid CSS without spaces. Fixed in the legacy add-on.- Headings never got their font-family rule. The rule had a trailing comma in its selector list, so browsers dropped it.
- h4–h6 were fixed px. On phones h4 (34px) could be larger than h3. All headings are now fluid.
- Breakpoints were inconsistent. About 25 different values were standardised to 5.
- The CSS was much bigger than it needed to be. About 140 KB of px spacing classes became a variable-driven scale.
Current Chrome, Edge, Firefox and Safari (Safari 16.2+ / iOS 16.2+). The framework uses
CSS cascade layers, color-mix(), clamp() and min().