Skip to content

Instantly share code, notes, and snippets.

@alalfakawma
Last active January 30, 2021 14:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alalfakawma/b94de00f31895b91077a2e3f71ace1fe to your computer and use it in GitHub Desktop.
Save alalfakawma/b94de00f31895b91077a2e3f71ace1fe to your computer and use it in GitHub Desktop.
Bulma SCSS Table column width helper
/*
Author: Aseem Lalfakawma <alalfakawma.github.io>
This SCSS mixin will allow sizing of table columns in Bulma CSS Framework.
The Bulma framework does not support this yet, this small code snippet fixes this.
USAGE:
* Should be applied on TH element, it controls all the columns under it *
The class should be "is-#",
is-1 will give the first widthamount, is-2 will give the second.
Eg. The code below shows the widthAmounts as (1, 2.5, 3, 4 , 5, 6, 7)
When typing <th class="is-2">, the width will be 2.5em, as the second value in widthAmounts array is 2.5
*/
$widthAmounts: (1, 2.5, 3, 4 , 5, 6, 7); // Just add the numbers here, you can use points too.
$widthUnit: "em"; // Add the unit here (rem|em|px|%)
@each $width in $widthAmounts {
$i: index($widthAmounts, $width);
.table thead th.is-#{$i} {
width: #{$width}#{$widthUnit} !important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment