Functional And Responsive Template

Inspired by TailwindCSS

fart.css is a small set of utility classes to help with responsive web design that leverage EQCSS to allow authors to set element-based breakpoints (using element queries and container queries).

The framework introduces a number of HTML attributes that can be used anywhere which are composed of three parts:

This means when writing styles for a breakpoint you want to have happen when an element reaches a width of at least 500px, you could add the attribute min-width-500="" to your element. Any CSS properties set to the value of this attribute will apply when the breakpoint is true. In the following example, our div element would turn blue when it was wider than 500px:

<div min-width-500="background: blue">fart.css demo</div>

This is because in our fart.css stylesheet there's the following EQCSS element query:

@element [min-width-500] and (min-width: 500px) {
  $this { eval('getAttribute("min-width-500")') }
}

This means whenever the (min-width: 500px) breakpoint is true for any element in the page with a [min-width-500] attribute, the value of that attribute eval('getAttribute("min-width-500")') gets used as the content of a rule for $this, which refers to each individual element matching the breakpoint separately.

Available Attributes

Width-based

Height-based

Children-based

Links