A {{ 2col }} shortcode and styling to make a 2 column grid
If the shortcode contains only figures, lay it out wide and add XL margins like other figures.
This commit is contained in:
parent
7d56bd2f78
commit
1e6db43354
3 changed files with 42 additions and 0 deletions
|
@ -71,6 +71,7 @@ hr {
|
|||
".figure"
|
||||
".highlight"
|
||||
".instagram-media"
|
||||
".two-column:has(figure:first-child + figure:last-child)"
|
||||
)
|
||||
", "
|
||||
-}}
|
||||
|
|
|
@ -138,3 +138,34 @@ section.content--small-right-column {
|
|||
margin-block: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************
|
||||
* 2 COLUMN CONTAINER
|
||||
*********************/
|
||||
|
||||
main.content > .two-column {
|
||||
display: grid;
|
||||
grid-column: main-start / main-end;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
|
||||
&.wide {
|
||||
grid-column: wide-gutter-start / wide-gutter-end;
|
||||
}
|
||||
|
||||
> :first-child {
|
||||
grid-column: unset;
|
||||
}
|
||||
|
||||
> :last-child {
|
||||
grid-column: unset;
|
||||
}
|
||||
|
||||
&:has(figure:first-child + figure:last-child) {
|
||||
gap: var(--space-xs);
|
||||
grid-column: wide-gutter-start / wide-gutter-end;
|
||||
}
|
||||
}
|
||||
|
|
10
layouts/shortcodes/2col.html
Normal file
10
layouts/shortcodes/2col.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{{- $size := .Get 0 | default "main" -}}
|
||||
|
||||
{{- $classes := slice "two-column" -}}
|
||||
{{- if eq $size "wide" -}}
|
||||
{{- $classes = $classes | append "wide" -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="{{ delimit $classes " " }}">
|
||||
{{ .Inner }}
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue