🎯 The Problem
Traditional CSS frameworks force you to clutter your HTML with utility classes:
<button class="btn btn-primary btn-lg flex items-center gap-2 px-6 py-3 rounded-lg shadow-md hover:shadow-lg">
<svg class="w-5 h-5">...</svg>
Click me
</button>
✨ Our Solution
NoCSS uses modern CSS selectors to detect structure and context:
<button>
<svg>...</svg>
Click me
</button>
The framework automatically detects the icon and applies proper spacing, sizing, and styling.
🔧 How It Works
Contextual Selectors
NoCSS uses the :has() selector to detect parent-child relationships:
/* Buttons with icons get automatic spacing */
button:has(svg) {
display: flex;
align-items: center;
gap: var(--space-2);
}
Position-Based Styling
Element styling changes based on position in the DOM:
/* First button = primary style */
button {
background: var(--color-primary);
}
/* Second+ buttons = secondary style */
button:nth-of-type(n+2) {
background: var(--color-secondary);
}
Sibling Combinators
Related elements are styled based on their relationships:
/* Labels followed by inputs get spacing */
label + input {
margin-top: var(--space-2);
}
Semantic Attributes
We use ARIA and data attributes instead of classes:
<a href="#" aria-current="page">Active Link</a>
<pre data-lang="javascript"><code>...</code></pre>
<div role="alert" data-type="success">Success!</div>