$cells.forEach(el => {
const parentWidth = el.parentElement.offsetWidth;
const percentage = el.offsetWidth / parentWidth * 100;
- el.append(`${Math.round(percentage)}`);
+ el.innerHTML = (`${percentage.toFixed(2)}`);
+ // el.append(`${Math.round(el.offsetWidth)}`);
});
// Functions
--columnGap: 2rem;
}
+.grid-container {
+ box-shadow: 0 0 0 1px #7a7a7a;
+ margin: 0 auto;
+ max-width: 1000px;
+ padding: 0 !important;
+}
+
.grid {
+ --gridGap: 0.75rem;
+ --gridGap: 0;
+ --gridColumnGap: var(--gridGap);
+ --gridRowGap: var(--gridGap);
display: grid;
- grid-column-gap: 0.75rem;
- grid-column-gap: 1px;
- grid-row-gap: 0.75rem;
- grid-row-gap: 1px;
+ grid-column-gap: var(--gridColumnGap);
+ grid-row-gap: var(--gridRowGap);
}
.grid:not(:last-child) {
padding: 1rem;
}
+.cell.is-1-tall {
+ grid-row: span 1;
+}
+
.cell.is-1-wide {
grid-column: span 1;
}
+.cell.is-2-tall {
+ grid-row: span 2;
+}
+
.cell.is-2-wide {
grid-column: span 2;
}
+.cell.is-3-tall {
+ grid-row: span 3;
+}
+
.cell.is-3-wide {
grid-column: span 3;
}
+.cell.is-4-tall {
+ grid-row: span 4;
+}
+
.cell.is-4-wide {
grid-column: span 4;
}
+.cell.is-5-tall {
+ grid-row: span 5;
+}
+
.cell.is-5-wide {
grid-column: span 5;
}
+.cell.is-6-tall {
+ grid-row: span 6;
+}
+
.cell.is-6-wide {
grid-column: span 6;
}
<html lang="en" class="has-navbar-fixed-top {% if page.route %}route-{{page.route}}{% elsif page.layout %}route-{{page.layout}}{% endif %}">
{% include head.html %}
<body>
-<section class="section">
+<section class="section grid-container">
<div class="grid has-4-columns">
<div class="cell is-4-wide">
<div class="cell">
Cell
</div>
- <div class="cell">
+ <div class="cell is-2-wide">
Cell
</div>
- <div class="cell">
+ <div class="cell is-4-tall">
Cell
</div>
<div class="cell">
$cells.forEach(function (el) {
var parentWidth = el.parentElement.offsetWidth;
var percentage = el.offsetWidth / parentWidth * 100;
- el.append('' + Math.round(percentage));
+ el.innerHTML = '' + percentage.toFixed(2);
+ // el.append(`${Math.round(el.offsetWidth)}`);
});
// Functions
+.grid-container
+ box-shadow: 0 0 0 1px $grey
+ margin: 0 auto
+ max-width: 1000px
+ padding: 0 !important
+
.grid
+ --gridGap: 0.75rem
+ --gridGap: 0
+ --gridColumnGap: var(--gridGap)
+ --gridRowGap: var(--gridGap)
+block
display: grid
- grid-column-gap: 0.75rem
- grid-column-gap: 1px
- grid-row-gap: 0.75rem
- grid-row-gap: 1px
+ grid-column-gap: var(--gridColumnGap)
+ grid-row-gap: var(--gridRowGap)
$var: #{"1fr"}
@for $i from 1 through 5
&.has-#{$i + 1}-columns
padding: 1rem
@for $i from 1 through 6
+ &.is-#{$i}-tall
+ grid-row: span $i
&.is-#{$i}-wide
grid-column: span $i