homehsmilecss-extensions

Extensions of standard CSS introduced in h-smile core.

The @const rule

@const rule allows to define some named and constant value and use that value in forecoming style declarations as a value of style attribute.
Sample of such const declaration (CSS+):

/* declaration of the constant: */
@const BASE_COLOR
: #00FF00;
/* style declaration using such constant: */
#myelement { border: 1px solid @BASE_COLOR; }

First line here defines BASE_COLOR constant and in last line it is used as a value of attribute.

@const rule is using following notation:

@const name [, name1 [, name2 ... ]] : values ;

collection of values (after ':' )  will be assigned to constant(s) on the left side. values here is a sequence of attribute values alllowed by CSS. It can be single value (as #00FF00 above) or set of values defining compound (shortcut) attribute. For example here is definition of constant that define set of background attributes as a single entity.

@const MY_BACKGROUND: yelllow repeat url(hatch.png);

#myelement { background: @MY_BACKGROUND; }

Insertion point of the constant is marked by symbol '@' immediately followed by name of the constant used in correspondent @const declaration.

scope rules of the @const are simple:

  1. @const declaration is global. Constant declared in one file is seen and can be used in all consequent css files and declarations used in the document.
  2. @const declaration is using first-come-first-serve rule. Once defined constant cannot be overriden.
  3. It is not an error to define constant multiple times. But only very first declaration will be used.
Samples of @const definitions can be found in .../css-plus/constants.htm files of htmlayout and Sciter SDK distributions.

no menu!