PrestwoodBoards.com
-Collapse +Expand

Web Design

Search Web Design Group:

Advanced
-Collapse +Expand Web Design Group Home
-Collapse +Expand Message Board
-Collapse +Expand Knowledge Base
-Collapse +Expand Web Design Store
-Collapse +Expand Members Only
Prestwood Tip Jar
Tip Jar
Finding something useful?

Add to the
Tip Jar!

Prestwood eMagazine

Subscribe now!
Enter your email:


   PrestwoodBoardsKBWebsite DesignCascading Style Sheets (CSS)   
Go To Random Article

 
Web Design Cascading Style Sheets (CSS):
When LESS is more
By Wes Peterson
7/13/2010
 

If you're like me, you probably love CSS, but are also a little disappointed in a few things it lacks; like constants or variables.

LESS is a fairly new bit of genius that solves some of the shortcomings in Cascading Style Sheets.



A good example is what I'll call a wished-for "color catalog."  I often make one, but it's just several lines of commentedd-out reminders about the color values used throughout the rest of my CSS file.  I can copy-n-paste color values from my "catalog" into my CSS classes. It saves errors, but it's still inconvenient.

Wouldn't it be nice if we could specify color values just once, assigned to a named constant, then, instead of typing in those inscrutable hex values all over your css, you could simply use your constant name for the color?

LESS lets you do that - and more.

It doesn't offer constants, but its variables can certainly do the job. It also offers "mixins," operations, and nested rules. The .NET version also offers a few useful functions.

How such a thing could be done is probably obvious: You write a LESS file, very much like an ordinary CSS file, but using the syntactical constructs introduced by LESS. Then you run your file through the LESS processor and it emits a standard CSS file.

There is obviously one potential downside: It adds a build step to your projects (unless you're working in .NET).  If you don't mind that, you should certainly look into LESS. 

Here are the pertinent Links:

http://lesscss.org/
This is the original LESS project, and uses a Ruby Gem to process your LESS files.

http://www.dotlesscss.com/
This is the .NET incarnation of LESS.  It has provisions for automating the processing of LESS files.

News Contributed By Prestwood staff member Wes Peterson:
Wes
Email Approved! E CA USA

Wes Peterson is a Senior Programmer Analyst with Prestwood IT Solutions where he develops custom Windows software and custom websites. When Wes is not coding for clients, he participates in this online community. Prior to his 10-year love-affair with Delphi, he worked with several other tools and databases. Currently he specializes in VS.Net using C# and VB.Net. To Wes, the .NET revolution is as exciting as the birth of Delphi.


Comments

0 Comments.
Would you like to comment? Reply? Ask a question? Say thanks?
Add Comment



 KB Article #102180 Counter
79
Since 7/13/2010

Sponsored Ad
Brought to you by Prestwood IT Solutions
We hope you are enjoying our knowledge base! We welcome your participation in our open online community. As the caretakers, we pay our staff to moderate, edit, and contribute free content here in an effort to promote our software development company. Keep us in mind if you or your company needs help. Whether you need a single developer or a team, consider Prestwood. We are an American company that keeps jobs in America (no off shoring and no need for H-1B developers). Our hope is that you will put some or all of your development tasks in our hands. We specialize in hourly help (1 hour minimum), custom websites from $2k to $40k, business database applications from $5k to $60k, and enterprise application development starting from $20k. Talented Developer?
If you are a talented developer and would like to work with us, start by filling out our Register for Work form.
 
879 People Online Now!!  
Online Now: Sign In to see who's online now!  Not a member? Join Prestwood now. It's free!