Width & height setters
These setter classes help you set width and height for elements, they are defined in _config.scss file, so you can add more setter classes with custom values.
Width
index.html
<div class="my-box style-blue width-100p">100%</div>
<div class="my-box style-green width-75p">75%</div>
<div class="my-box style-purple width-50p">50%</div>
<div class="my-box style-orange width-25p">25%</div>
<div class="my-box style-red width-10p">10%</div>
style.css
.my-box {
height: 30px;
padding: 5px 10px;
margin: 20px 0;
border-radius: 12px;
}
index.html
<div class="my-box style-blue width-100p">100%</div>
<div class="my-box style-green width-75p">75%</div>
<div class="my-box style-purple width-50p">50%</div>
<div class="my-box style-orange width-25p">25%</div>
<div class="my-box style-red width-10p">10%</div>
style.css
.my-box {
width: 30px;
padding: 5px 10px;
margin: 0 10px;
border-radius: 12px;
writing-mode: sideways-rl;
}
Here are the predefined classes:
| Width class | Height class | Value |
|---|---|---|
.width-0p | .height-0p | 0 |
.width-10p | .height-10p | 10% |
.width-15p | .height-15p | 15% |
.width-25p | .height-25p | 25% |
.width-30p | .height-30p | 30% |
.width-50p | .height-50p | 50% |
.width-60p | .height-60p | 60% |
.width-75p | .height-75p | 75% |
.width-90p | .height-90p | 90% |
.width-95p | .height-95p | 95% |
.width-100p | .height-100p | 100% |
Custom helper classes
Note that these classes can be customized in _config.scss file, there are two variables called $WIDTH_LIST and $HEIGHT_LIST, all classes are generated from these lists.
So it is possible to create customized helper classes for width and height simply!
In the example below 50-pixels and 5-em are added to the defaults:
_config.scss
// This list will be converted to helper classes.
// .width-[]
$WIDTH_LIST: (
0p: 0,
10p: 10%,
15p: 15%,
25p: 25%,
30p: 30%,
50p: 50%,
60p: 60%,
75p: 75%,
90p: 90%,
95p: 95%,
100p: 100%,
50-pixels: 50px,
5-em: 5em,
);
// This list will be converted to helper classes.
// .height-[]
$HEIGHT_LIST: (
0p: 0,
10p: 10%,
15p: 15%,
25p: 25%,
30p: 30%,
50p: 50%,
60p: 60%,
75p: 75%,
90p: 90%,
95p: 95%,
100p: 100%,
50-pixels: 50px,
5-em: 5em,
);