My goal is to be as quick as possible while writing code. I therefore have come up with some classes that speed things up when I make websites.
Take a look at the demo and docs if you want to see it in action
blomdahldaniel.github.io/lazy-less-classes-bootstrap-3
You can directly use the css files in the dist
folder.
Just copy the lazy-less folder, paste it into your project (for example inside your bootstrap folder) and import the
all-my-lazy-stuff.less together with the bootstrap variables.less
files.
Import together with the bootstrap stuff: (for example inside your bootstrap.less
file)
// import the lazy-stuff
@import 'lazy-stuff/all-my-lazy-stuff';
- text color
- background color
- border color
- pointer class for
cursor: pointer;
What comes out of the box is all the color-classes that comes with Bootstrap 3:
- white
- black
- primary
- success
- info
- warning
- danger
- gray-ligther
- gray-light
- gray
- gray-dark
- gray-darker
you can add a hover effects to the 3 elements. Simply write element-color-hover.
Example:
<div class="text-info text-success-hover">
Lorem ipsum.
</div>
Will make a div with info-colored text and on hover it will turn green (success color).
Many times you dont want a different color on hover, you want a darkened version of the color. Here the smart inheritance comes to play.
<div class="bg-info bg-hover">
Lorem ipsum.
</div>
Will give me a div with the background-color info. And on hover, that background will be affected by the less
function darken(@color, 10%);
Many times if you ad a hover class to something you can want a pointer. Therefore, quicly add the .pointer
class to your object to use that cursor.
This will add the following css: cursor: pointer;
<div class="bg-info bg-hover pointer">
Lorem ipsum.
</div>
.pointer
(adds csscursor: pointer;
)
text-primary
bg-success
border-danger
text-primary-hover
bg-success-hover
border-danger-hover
smart inheritance hover, color gets 10% darker.
text-primary text-hover
bg-success bg-hover
border-danger border-hover