Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning less.js
  • Table Of Contents Toc
Learning less.js

Learning less.js

By : Alex Libby
5 (2)
close
close
Learning less.js

Learning less.js

5 (2)
By: Alex Libby

Overview of this book

If you are a designer or developer who wants to quickly learn how to harness the power of Less.js to write more efficient CSS styles that can be applied to a website of any size, then this book is for you. This book will help you master both the basic functions and advanced features of Less.js. It would be helpful to have some familiarity of writing CSS styles, although no prior experience of using CSS preprocessors is required.
Table of Contents (17 chapters)
close
close
16
Index

Adding basic mixins

We can start by adding in two simple mixins to our code—let's begin by editing a copy of buttons.css and then adding the following code at the start of the file:

.shadow() { box-shadow: 0 1px 2px rgba(0,0,0,.2); text-shadow: 0 1px 1px rgba(0,0,0,.3); }

.formfont { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }

Next, we can remove the original code from the .button style block, as this is no longer needed—it will be replaced by the names of our three simple mixins:

.button {
  .shadow;
  .formfont;
  display: inline-block;
  outline: none;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  padding: .5em 2em .55em;
  border-radius: .5em;
}

Save this as mixins1.less; we can then remove the buttons.css link that is already in the code. Don't forget to add in a link for our Less file, within mixins1.html:

    <link rel="stylesheet" type="text/less" href="css/mixins1.less">

Save the HTML...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning less.js
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon