Design Principles

Startr.Style is built on a foundation of clear design principles that prioritize simplicity, performance, and developer experience. At its core, Startr.Style embraces the concept of Locality of Behaviour (LoB) – keeping styling decisions close to the HTML elements they affect.

Core Philosophy

"Style should be immediate, obvious, and maintainable. When you see an element, you should understand its styling without hunting through separate CSS files."

Locality of Behaviour (LoB)

The central principle behind Startr.Style is Locality of Behaviour. This means that the styling of an HTML element should be immediately visible and understandable when looking at that element's markup.

Problems with Traditional CSS Approaches

Separation of Concerns Gone Wrong

  • Hunting for styles: Developers spend time searching through multiple CSS files to understand element styling
  • Complex toolchains: Build processes, bundlers, and CSS-in-JS solutions add unnecessary complexity
  • Large file sizes: Traditional utility frameworks generate massive CSS files with unused code
  • Maintenance overhead: Changes require touching multiple files and understanding complex cascading rules

The Startr.Style Solution

Instead of classes, Startr.Style uses CSS custom properties (variables) directly in the style attribute:

<!-- Traditional CSS approach -->
<div class="bg-blue-500 text-white p-4 rounded-lg shadow-md">
  Content
</div>

<!-- Startr.Style approach -->
<div style="--bg: #2196f3; --c: white; --p: 1rem; --br: 8px; --shadow: 0 4px 6px rgba(0,0,0,0.1);">
  Content
</div>

Key Design Principles

1. Inline-First Styling

Startr.Style encourages styling directly in HTML using CSS custom properties. This approach provides immediate feedback and eliminates the disconnect between HTML structure and visual presentation.

✅ Benefits

  • Visual styling visible at element level
  • No CSS file hunting
  • Immediate preview in browser dev tools
  • Self-documenting code
  • Easy debugging and modification

🎯 Example

<button style="--bg: var(--primary); --c: white; --p: 0.75rem 1.5rem; --br: 4px; --cursor: pointer;">
  Click me
</button>

2. Unleash CSS Variable Power

Unlike traditional utility frameworks that limit you to predefined values, Startr.Style gives you access to the full CSS specification through custom properties.

<!-- Any valid CSS value works -->
<div style="--bg: linear-gradient(45deg, #ff6b6b, #4ecdc4);">Gradient background</div>
<div style="--bg: url('pattern.svg');">Image background</div>
<div style="--bg: rgba(255, 0, 0, 0.1);">Transparent background</div>
<div style="--bg: hsl(200, 50%, 50%);">HSL color</div>

3. Responsive Design Without Media Queries

Startr.Style supports responsive design directly in the style attribute using viewport-specific custom properties.

<!-- Responsive padding: small on mobile, large on desktop -->
<div style="--p: 1rem; --p-lg: 2rem; --p-xl: 3rem;">
  Responsive content
</div>

<!-- Different layouts for different screen sizes -->
<div style="--d: block; --d-md: flex; --fd-md: row; --jc-md: space-between;">
  <div>Item 1</div>
  <div>Item 2</div>
</div>

4. Minimal CSS Footprint

Traditional utility frameworks can be massive. Tailwind CSS, for example, can exceed 3MB in development. Startr.Style achieves the same functionality with a fraction of the size.

Size Comparison

  • Tailwind CSS (dev): ~3.2MB
  • Bootstrap: ~187KB
  • Startr.Style: ~45KB

Result: Faster loading, better performance, smaller bundle sizes

5. No Build Step Required

Startr.Style works immediately without any build process, compilation, or tooling. Just include the CSS file and start styling.

<!-- Single line to get started -->
<link rel="stylesheet" href="https://startr.style/style.css">

Future: Web Components Integration

While Startr.Style minimizes the need for CSS classes, we recognize that complex interactive components benefit from encapsulation. Our roadmap includes embracing Web Components for advanced elements, taking inspiration from libraries like Shoelace.

Web Components Strategy

  • Simple styling: Use Startr.Style inline variables
  • Complex components: Build custom Web Components
  • Best of both worlds: Immediate styling + powerful encapsulation
  • Future-ready: Native browser support, no framework lock-in

Philosophical Alignment

Startr.Style aligns with several design philosophies from our framework:

Brutalist Influence

Like Brutalist Web Design, Startr.Style exposes the raw structure. You see exactly what styling is applied to each element without layers of abstraction.

Modernist Principles

Following Modernist design, form follows function. Every utility serves a clear purpose, and there's intentional restraint in what we include.

Experimental Innovation

Like our Experimental approach, Startr.Style pushes boundaries by reimagining how we think about CSS utility frameworks.

Practical Benefits

🚀 Developer Experience

  • No context switching between files
  • Instant visual feedback
  • Easy debugging in dev tools
  • Self-documenting components

⚡ Performance

  • Smaller CSS file sizes
  • No unused CSS code
  • Faster page loads
  • Better runtime performance

🔧 Maintainability

  • No CSS cascade issues
  • Easy to modify styles
  • Clear component boundaries
  • Reduced technical debt

🎨 Design Freedom

  • Any CSS value supported
  • No design system constraints
  • Flexible responsive design
  • Easy prototyping

Getting Started with These Principles

Ready to embrace Locality of Behaviour and inline-first styling? Here's how to get started:

  1. Include Startr.Style: Add the single CSS file to your project
  2. Start small: Begin with simple utilities like --p (padding) and --m (margin)
  3. Think inline: When you need to style an element, add it directly to the style attribute
  4. Use responsive modifiers: Add -sm, -md, -lg suffixes for responsive design
  5. Embrace the freedom: Use any CSS value, not just predefined options

Next Steps

These design principles guide every decision in Startr.Style, from API design to feature selection. By embracing Locality of Behaviour and inline-first styling, we create more maintainable, performant, and enjoyable web development experiences.

Star Fork Download

Carefully crafted by the Startr Team with the help of our contributors.

Startr Style licensed MIT, docs CC BY 3.0.