Menu
CSS expands palette with variables

CSS expands palette with variables

The CSS Working Group is taking feedback on how variables be named

Potentially simplifying the work for Web designers, the working group behind the Cascading Style Sheets (CSS) Web standard is extending the language so that it supports the ability to define and call variables.

Tab Atkins, a Google developer who is on the working group has been taking suggestions this week as to what may be the best approach to represent variables in CSS.

As its name indicates, CSS is a stylesheet language, one that defines for a browser how a Web page, Web presentation or some other form of electronic content should be formatted. CSS offers a set of keywords to specify stylistic elements in a page layout, such as the font and spacing of text, and the color of the background. CSS can be embedded in the HTML page itself, either in the header or in the body. Or CSS code can be a separate file on the server, which is then referenced by the page.

To date, CSS has not yet offered a way for designers to define their own properties. Users have asked for this feature at least since the language's launch in 1998, according to CSS Working Group co-chair Daniel Glazman. Although the CSS Working Group uses the name "variables" to define this new feature, CSS variables would not have the full scope of the variable primitive found in most languages, Glazman explained. But it would allow designers to define the properties they use on a regular basis.

Nonetheless, such a naming capability would be handy, according to a draft document proposing the addition. It can cut down the amount of copying and pasting a designer must do to update a large Web site, for instance. If an organization has a standard set of colors and fonts to use across a Web site, CSS variables would allow these unique properties to be named by the designer. Then, when a stylistic change needs to be made, the designer simply reassigns the new values to the variables, eliminating the error-prone task of updating that information in each separate stylesheet and Web page.

The CSS working group is still trying to determine how the variables should best be represented in CSS. The designers favor declaring by using a reserved keyword, "var," in front of a new variable, so a new variable would be fined as var-NewVariable. But some users have expressed an interest in a specific key to define a variable, such as the "$" symbol, as in $NewVariable. Atkins cautioned against this approach as it limits the use of "$" for other variable activities, however.

While such matters may seem trivial, those who use a programming or markup language on a daily basis would benefit from the language being as consistent, and predictable, as possible. For instance, PHP has been roundly criticized for having an inconsistent syntax. Because PHP function names vary from one to the next in how they are formatted -- sometimes they have underscores and sometimes they don't -- programmers have more difficulty remembering or guessing the names of PHP functions, forcing them to consult documentation.

Designers who have an opinion about how CSS variables should be formatted should make their thoughts known within the next few weeks. The CSS Variables specification will remain in a working draft status for the next three weeks or so. This is the time when the group will be in the best position to mull new ideas, Atkins explained by an e-mail message.

Joab Jackson covers enterprise software and general technology breaking news for The IDG News Service. Follow Joab on Twitter at @Joab_Jackson. Joab's e-mail address is Joab_Jackson@idg.com


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Brand Post

What to expect from your IT Distributor

Whether you’re just starting out or you’ve been around since before the dot com rollercoaster, choosing the right distribution partner can be a pivotal factor in your success. This definitive guide outlines the traits that every IT partner needs to look for in their IT Distributor.

Featured

Slideshows

Channel gathers to celebrate the Reseller News Innovation Awards 2020 winners

Channel gathers to celebrate the Reseller News Innovation Awards 2020 winners

More than 500 channel leaders gathered in Auckland on 21 October at the ​Reseller News Innovation Awards ​2020 to celebrate the achievements of the New Zealand technology industry's top partners, start-ups, vendors, distributors and individuals.

Channel gathers to celebrate the Reseller News Innovation Awards 2020 winners
Meet the winners of the 2020 Reseller News Innovation Awards

Meet the winners of the 2020 Reseller News Innovation Awards

Reseller News honoured the standout players of the New Zealand channel in front of more than 500 technology leaders in Auckland on 21 October, recognising the achievements of top partners, start-ups, vendors, distributors and individuals.

Meet the winners of the 2020 Reseller News Innovation Awards
Meet the Reseller News 30 Under 30 Tech Awards 2020 winners

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners

This year’s Reseller News 30 Under 30 Tech Awards were held as an integral part of the first entirely virtual Emerging Leaders​ forum, an annual event dedicated to identifying, educating and showcasing the New Zealand technology market’s rising stars. The 30 Under 30 Tech Awards 2020 recognised the outstanding achievements and business excellence of 30 talented individuals​, across both young leaders and those just starting out. In this slideshow, Reseller News honours this year's winners and captures their thoughts about how their ideas of leadership have changed over time.​

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners
Show Comments