Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
LESS WEB DEVELOPMENT ESSENTIALS

You're reading from   LESS WEB DEVELOPMENT ESSENTIALS Use CSS preprocessing to streamline the development and maintenance of your web applications

Arrow left icon
Product type Paperback
Published in Apr 2014
Publisher
ISBN-13 9781783981465
Length 202 pages
Edition Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Bass Jobsen Bass Jobsen
Author Profile Icon Bass Jobsen
Bass Jobsen
Arrow right icon
View More author details
Toc

Escaping values


Less is an extension of CSS. This means that Less gives an error when it comes across invalid CSS or evaluates a valid CSS during compilation. Some browsers define properties with an invalid CSS. Well-known examples will include something such as property: ms:somefunction(). Some of these rules can be replaced by vendor-specific rules. It is important to note that invalid property values won't get compiled in Less.

A new function, calc(), in CSS3 is a native CSS way of doing simple math as a replacement for a value of any length.

In both cases, Less won't give us the right value when we compile or import.

@aside-width: 80px;
.content {
width: calc(100% -  @aside-width)
}

The preceding code gets compiled into the following code:

.content {
  width: calc(20%);
}

From the preceding code, @aside-width: 80px; is the declaration of a variable with the name aside-width. This variable gets a value of 80 pixels. More information on variables will be covered in the following sections. However...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image