Re: Inheritance, variables and CSS

Giganews Newsgroups
Subject: Re: Inheritance, variables and CSS
Posted by:  Jukka K. Korpela (jkorpe…
Date: Tue, 31 Jan 2006

Giggle Girl wrote:

> Can you use a variable in CSS


> Here is a snip from the current sheet:

That's irrelevant, except as evidence that makes it probable that the
style sheet (and quite probably the markup, too) is poorly designed.

> Since "ff9900" is used over and over, can I just set it once somewhere?

No, there are no variables in CSS.

You can, however, set e.g.
..foobar { border: solid 2px #f90; }
and then set just e.g. border-style: none for those sides that should
have no border.

> PS: I am a backend programmer, who is new to CSS.

Lesson 0: CSS is not a programming language, and won't become one.

P.S. What you wrote about, or what I wrote about, has nothing to do with
inheritance (which is a CSS term and should be used only in that term
meaning when discussing CSS; it is also misunderstood by 99 % of people
who ask questions about CSS inheritance).


In response to

Inheritance, variables and CSS posted by Giggle Girl on 31 Jan 2006