Top Related Projects
Modern CSS framework based on Flexbox
Skeleton: A Dead Simple, Responsive Boilerplate for Mobile-Friendly Development
A minimalist CSS framework.
Spectre.css - A Lightweight, Responsive and Modern CSS Framework
A drop-in collection of CSS styles to make simple websites just a little nicer
MVP.css — Minimalist classless CSS stylesheet for HTML elements
Quick Overview
Marx is a classless CSS reset and boilerplate that provides a minimalist and opinionated starting point for web development projects. It aims to create a consistent and visually appealing base style without the need for complex class structures, making it easy to build upon for custom designs.
Pros
- Lightweight and minimal, with a small file size
- Easy to implement and use, requiring no additional classes
- Provides a clean and modern default appearance for HTML elements
- Responsive and mobile-friendly out of the box
Cons
- Limited customization options without modifying the source CSS
- May not be suitable for complex layouts or designs that require extensive custom styling
- Some developers may prefer more opinionated frameworks with pre-built components
- Lack of JavaScript components or interactive elements
Code Examples
- Basic HTML structure with Marx:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Marx Example</title>
<link rel="stylesheet" href="https://unpkg.com/marx-css/css/marx.min.css">
</head>
<body>
<main>
<h1>Welcome to Marx</h1>
<p>This is a simple example using Marx CSS.</p>
</main>
</body>
</html>
- Form styling with Marx:
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<button type="submit">Submit</button>
</form>
- Responsive grid layout using Marx:
<div class="row">
<div class="col">
<h2>Column 1</h2>
<p>Content for the first column.</p>
</div>
<div class="col">
<h2>Column 2</h2>
<p>Content for the second column.</p>
</div>
</div>
Getting Started
To use Marx in your project, simply include the CSS file in your HTML:
<link rel="stylesheet" href="https://unpkg.com/marx-css/css/marx.min.css">
Alternatively, you can install Marx using npm:
npm install marx-css
Then import it in your JavaScript file:
import 'marx-css/css/marx.min.css';
Once included, Marx will automatically style your HTML elements without the need for additional classes.
Competitor Comparisons
Modern CSS framework based on Flexbox
Pros of Bulma
- More comprehensive and feature-rich CSS framework
- Larger community and ecosystem with extensive documentation
- Modular architecture allowing for customization and partial imports
Cons of Bulma
- Larger file size and potentially slower load times
- Steeper learning curve due to more complex class structure
- May require additional customization to achieve a unique design
Code Comparison
Marx:
body {
color: #333;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
line-height: 1.5;
margin: 0 auto;
max-width: 50em;
padding: 1em;
}
Bulma:
.container {
flex-grow: 1;
margin: 0 auto;
position: relative;
width: auto;
}
@media screen and (min-width: 1024px) {
.container {
max-width: 960px;
}
}
Marx provides a simpler, opinionated default styling for basic HTML elements, while Bulma offers a more structured approach with customizable classes and responsive design features.
Skeleton: A Dead Simple, Responsive Boilerplate for Mobile-Friendly Development
Pros of Skeleton
- Lighter weight and more minimalist, focusing on core layout and typography
- Includes a responsive grid system for easier layout creation
- Provides a mobile-first approach with breakpoints for different screen sizes
Cons of Skeleton
- Less comprehensive styling for form elements and buttons
- Fewer pre-styled components compared to Marx
- May require more custom CSS for complex designs
Code Comparison
Marx:
body {
color: #333;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
line-height: 1.4;
}
Skeleton:
body {
font-size: 1.5em;
line-height: 1.6;
font-weight: 400;
font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #222;
}
Both frameworks provide basic styling for the body element, but Marx uses a more extensive system font stack, while Skeleton specifies a primary font (Raleway) with fallbacks. Marx also sets a slightly tighter line height compared to Skeleton.
A minimalist CSS framework.
Pros of Milligram
- Lighter weight (2kb gzipped) compared to Marx's larger file size
- More extensive documentation and examples
- Active development with more recent updates
Cons of Milligram
- Less opinionated design, requiring more custom styling
- Fewer pre-styled elements out of the box
- Lacks some accessibility features present in Marx
Code Comparison
Marx:
body {
color: #212121;
font-family: 'Arial', sans-serif;
line-height: 1.5;
margin: 0;
max-width: 100%;
}
Milligram:
body {
color: #606c76;
font-family: 'Roboto', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
font-size: 1.6em;
font-weight: 300;
letter-spacing: .01em;
line-height: 1.6;
}
Both frameworks provide minimal CSS styling, but Marx offers more opinionated defaults, while Milligram focuses on providing a lightweight foundation for custom designs. Marx includes more accessibility features and pre-styled elements, making it easier to create a functional website quickly. Milligram, on the other hand, offers a smaller file size and more flexibility for customization, but requires more effort to achieve a polished look. The choice between the two depends on project requirements and personal preferences for styling and development approach.
Spectre.css - A Lightweight, Responsive and Modern CSS Framework
Pros of Spectre
- More comprehensive framework with a wider range of UI components
- Better documentation and examples
- Actively maintained with regular updates
Cons of Spectre
- Larger file size, potentially impacting page load times
- Steeper learning curve due to more complex structure
- Less focused on minimalism compared to Marx
Code Comparison
Marx (CSS):
body {
color: #333;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1.6em;
line-height: 1.5;
margin: 0;
padding: 0;
}
Spectre (CSS):
.container {
margin-left: auto;
margin-right: auto;
padding-left: .4rem;
padding-right: .4rem;
width: 100%;
}
Marx focuses on basic styling for HTML elements, while Spectre provides more structured classes for layout and components. Marx aims for a classless approach, whereas Spectre relies on utility classes for customization.
Both frameworks offer responsive design, but Spectre provides more granular control through its grid system and utility classes. Marx is ideal for quick prototypes or simple projects, while Spectre is better suited for larger, more complex applications requiring a wider range of UI components and customization options.
A drop-in collection of CSS styles to make simple websites just a little nicer
Pros of Water.css
- Lighter weight (2.2KB vs 3.5KB for Marx)
- More customizable with multiple themes and dark mode support
- Actively maintained with recent updates
Cons of Water.css
- Less opinionated design, may require more custom styling
- Fewer pre-styled elements compared to Marx
- No built-in grid system
Code Comparison
Water.css:
body {
max-width: 800px;
margin: 20px auto;
padding: 0 10px;
font-family: sans-serif;
line-height: 1.5;
}
Marx:
body {
max-width: 960px;
margin: 0 auto;
padding: 1rem;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
line-height: 1.6;
}
Both CSS frameworks aim to provide simple, classless styling for HTML elements. Water.css focuses on lightweight, customizable designs with multiple themes, while Marx offers a more opinionated, feature-rich approach with a built-in grid system. Water.css is actively maintained and smaller in size, making it suitable for quick prototypes or minimalist designs. Marx, though slightly larger, provides more pre-styled elements and a consistent look out of the box, which may be preferable for certain projects.
MVP.css — Minimalist classless CSS stylesheet for HTML elements
Pros of MVP
- More comprehensive set of components and utilities
- Includes JavaScript functionality for interactive elements
- Offers a wider range of color options and themes
Cons of MVP
- Larger file size due to more features
- Steeper learning curve for beginners
- Less focused on minimalism compared to Marx
Code Comparison
Marx (CSS):
body {
color: #333;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
line-height: 1.5;
max-width: 50em;
margin: 0 auto;
padding: 1em;
}
MVP (CSS):
:root {
--border-radius: 5px;
--box-shadow: 2px 2px 10px;
--color: #118bee;
--color-accent: #118bee15;
--color-bg: #fff;
--color-bg-secondary: #e9e9e9;
--color-secondary: #920de9;
--color-secondary-accent: #920de90b;
--color-shadow: #f4f4f4;
--color-text: #000;
--color-text-secondary: #999;
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
--hover-brightness: 1.2;
--justify-important: center;
--justify-normal: left;
--line-height: 1.5;
--width-card: 285px;
--width-card-medium: 460px;
--width-card-wide: 800px;
--width-content: 1080px;
}
Both projects aim to provide minimal CSS frameworks, but MVP offers more features and customization options, while Marx focuses on simplicity and ease of use.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Marx
The classless CSS framework (perfect for Communists).
No JavaScript. No classes. Just raw HTML that looks good.
Add one stylesheet to plain, semantic HTML and the page styles itself. No class
names, no build step, no config. Marx 5 is a full rewrite: automatic light and
dark mode, a small --marx-* theming API, and zero specificity, so any CSS
you write wins.
Is Marx for you?
Marx is for small projects where you'd rather write content than wire up a component library: prose sites, docs, prototypes, quick landing pages. Use it straight from the box, or retheme it with a few custom properties.
Key features
- Zero classes: it works with the HTML you already have.
- Automatic dark mode with
color-schemeandlight-dark(). No toggle, no JS. - Zero specificity: every rule is wrapped in
:where()inside cascade layers, so your CSS overrides Marx without a fight or a single!important. - Modern base: a small, modern reset so browsers render consistently.
- Themeable: one set of
--marx-*custom properties is the whole API. - Modern CSS: logical properties (RTL-ready), a
remtype scale,:focus-visibleoutlines, and motion behindprefers-reduced-motion. - It just works.
Demo
Quick start
npm
npm install marx-css
CDN
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/marx-css@5/css/marx.min.css">
Bundler
With any bundler that reads the exports field (Vite, webpack, esbuild, â¦):
import "marx-css";
That loads the minified stylesheet.
Dark mode
Dark mode is automatic. Marx sets color-scheme: light dark and defines its
colors with light-dark(), so the page follows the visitor's OS or browser
preference with no toggle and no JavaScript.
Force a single scheme by overriding color-scheme on the root in your own CSS:
:root { color-scheme: light; } /* always light */
:root { color-scheme: dark; } /* always dark */
Theming
The whole theming API is the --marx-* custom properties below. Override any
of them in your own (unlayered) CSS. Because Marx lives in cascade layers, your
values win. Colors use light-dark(), so set both schemes at once or just
change the value you care about.
| Token | Purpose |
|---|---|
--marx-leading | Base line-height (1.5) |
--marx-flow | Vertical rhythm between block elements (1.25rem) |
--marx-measure | Max content width of main (48rem) |
--marx-radius | Corner radius for controls and surfaces |
--marx-space-2xs ⦠-xl | Spacing scale (0.25rem to 2.5rem) |
--marx-text-sm / -base | Body type sizes |
--marx-text-h1 ⦠-h6 | Heading sizes (2.5rem to 1rem) |
--marx-font-sans / -serif / -mono | Font stacks |
--marx-font-body | Font applied to body (defaults to sans) |
--marx-bg | Page background |
--marx-text | Body text color |
--marx-muted | Secondary/subtle text |
--marx-disabled | Disabled control text |
--marx-border | Borders and dividers |
--marx-surface | Raised surfaces (code, tables, wells) |
--marx-primary / --marx-primary-strong | Button/brand blue + hover |
--marx-on-primary | Text on primary surfaces |
--marx-link / --marx-link-hover | Link colors |
--marx-ring | :focus-visible outline color |
--marx-danger | Error/invalid feedback |
--marx-mark | <mark> highlight |
Example, a warmer accent and rounder corners:
:root {
--marx-primary: hotpink;
--marx-radius: 0.75rem;
}
Basic template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Marx Template</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/marx-css@5/css/marx.min.css">
</head>
<body>
<!-- main is the centered container -->
<main>
<nav>
<ul>
<li><a href="#"><b>First</b></a></li>
<li><a href="#">Second</a></li>
<li><a href="#">Third</a></li>
</ul>
</nav>
<article>
<h1>Article</h1>
<p>Plain HTML, styled automatically.</p>
</article>
<footer>
<p>© Matthew Blode</p>
</footer>
</main>
</body>
</html>
What's included
Installing marx-css gives you the compiled stylesheets plus the source:
.
âââ LICENSE.md
âââ README.md
âââ css
â âââ marx.css # readable build
â âââ marx.min.css # minified build (the one you ship)
â âââ marx.min.css.map
âââ src # authored partials, bundled by Lightning CSS
âââ marx.css # entry: declares the @layer order
âââ _tokens.css # the --marx-* theming API
âââ _preflight.css # cross-browser reset
âââ _base.css
âââ _typography.css
âââ _tables.css
âââ _buttons.css
âââ _form.css
Browser support
Marx targets Baseline 2024 browsers: Chrome/Edge 123+, Firefox 120+, and
Safari 17.5+. Older browsers still get a readable page: color-scheme keeps
text legible in light and dark, and buttons keep their color. They just lose
the finer theming like token-driven borders and surface tints.
Building from source
git clone https://github.com/mblode/marx.git
cd marx
npm install
npm run build # bundles src/ -> css/
See AGENTS.md for the architecture and contribution conventions.
Contributing to Marx
Pull requests are the way to go.
License
MIT
Crafted by
Matthew Blode
Top Related Projects
Modern CSS framework based on Flexbox
Skeleton: A Dead Simple, Responsive Boilerplate for Mobile-Friendly Development
A minimalist CSS framework.
Spectre.css - A Lightweight, Responsive and Modern CSS Framework
A drop-in collection of CSS styles to make simple websites just a little nicer
MVP.css — Minimalist classless CSS stylesheet for HTML elements
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot