Comment

Comment by romaniv

This is definitely better than no variables, but is it the best solution? I think most of the advantages of variables can be achieved through a technique that introduces no new syntax and a minimum of new keywords:

  .element {
	color: #06c;
	border-color: #006;
  }

  h1 {
	apply: .element;
	border-style: thick;
	border-width: solid;
  }
This will make H1 "pretend" that it has .element class applied to it, even though in HTML source code it doesn't. I think it's a conceptually simple and orthogonal solution. True variables differ from the current metality of CSS way too much.
parent romaniv 15 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton