Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,673 members, 7,813,243 topics. Date: Tuesday, 30 April 2024 at 09:25 AM

Here's How To Write Programmable/managable CSS - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Here's How To Write Programmable/managable CSS (346 Views)

7 Types Of Post To Write That Increases Blog Traffic / 10 Easy Ways To Write A Powerful And Addictive Introduction For Your Blog Post / 5 Amazing Ways To Write Interesting Blog Post Topics (2) (3) (4)

(1) (Reply)

Here's How To Write Programmable/managable CSS by jimfend: 10:27am On Nov 10, 2015
While I've enjoyed the flexibility and goodness of CSS Preprocessor like LESS for a long time, I discovered that many webmasters don't know about it yet.

LESS CSS allow you to extend CSS capabilities with programming features such as Variables, Functions or Mixin, and Operation which will enable you to build modular, scalable, and more manageable CSS styles.

Here is what it looks like:


.gradient (@color1, @color2) {
background: linear-gradient(top, @color1, @color2);
}
@color1: #0078bd;
.class1 {
background-color: @color1;
.class2 {
background-color: #fff;
color: @color1;
}
}

As you can see you can:
* Declare and use variables.
* You can nest rules.
* You can declare and use functions.
* And so much more.

There are also built in functions: Lets say you have a color and you want another shade of that same color, You can just do
 darken(color, 5%)
or
lighten(color, 5%)
.

All these allow for maximum code reuse, modularity and scalability.

Check http://viewslog.com/discussion/329/ if you want to learn more about LESS. I covered the basics of less with example codes to get you started right away.

(1) (Reply)

Get Cheap Premium Wordpress Theme / Make Money Online / Nigeria World Connect

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.