<content-split-block>
Two columns side by side, such as an image next to text, that stack on smaller screens.
import '@content-blocks/js/components/content-split-block';Examples
Image and text
One column on phones, two from 768px, with the text centred against the image.
<content-split-block columns="1|2">
<content-image
slot="column1"
alt="A warrior holding a sword before a stone wall"
src="https://images.unsplash.com/photo-1687567571255-94790b945651?w=600&h=600&fit=crop&auto=format&q=75"
aspect-ratio="1/1"
></content-image>
<content-text-block slot="column2" vertical="center" padding="1rem 0 0|0 0 0 1.25rem">
<content-line tag="h3" padding="0 0 0.5rem">The gate holds</content-line>
<content-line tag="p">She has kept the north gate for nine winters, and will hold it one more.</content-line>
</content-text-block>
</content-split-block>h3 {
font-size: 1.5rem;
font-weight: 700;
}// $ npm install @content-blocks/js
import '@content-blocks/js/components/content-split-block';
import '@content-blocks/js/components/content-image';
import '@content-blocks/js/components/content-text-block';
import '@content-blocks/js/components/content-line';<script type="module"
src="https://cdn.jsdelivr.net/npm/@content-blocks/js/dist/content-blocks/content-blocks.esm.js"></script>Looping video
A muted .mp4 loops in one column. reverse="false|true" puts it on the right from 768px.
<content-split-block columns="1|2" reverse="false|true">
<content-image slot="column1" alt="" src="https://videos.pexels.com/video-files/20706803/20706803-sd_640_360_25fps.mp4" aspect-ratio="1/1"></content-image>
<content-text-block slot="column2" vertical="center" padding="1.25rem">
<content-line tag="h3" padding="0 0 0.5rem">Forged in fire</content-line>
<content-line tag="p">The broken blade, made whole.</content-line>
</content-text-block>
</content-split-block>h3 {
font-size: 1.5rem;
font-weight: 700;
}
content-split-block {
color: #fff;
background: #1d4ed8;
}// $ npm install @content-blocks/js
import '@content-blocks/js/components/content-split-block';
import '@content-blocks/js/components/content-image';
import '@content-blocks/js/components/content-text-block';
import '@content-blocks/js/components/content-line';<script type="module"
src="https://cdn.jsdelivr.net/npm/@content-blocks/js/dist/content-blocks/content-blocks.esm.js"></script>Film in an overlay
The link opens a video in a content-overlay, and fill="#ex-split-film" makes it cover the whole split.
<content-split-block id="ex-split-film" columns="1|2">
<content-image
slot="column1"
alt="Polished armour in a dark hall"
src="https://images.unsplash.com/photo-1780499102459-603b3fedfe11?w=600&h=600&fit=crop&auto=format&q=75"
aspect-ratio="1/1"
></content-image>
<content-text-block slot="column2" vertical="center" padding="1.25rem">
<content-line tag="h3" padding="0 0 0.75rem">The armour waits</content-line>
<content-button href="#ex-split-film-video">▶ Watch the omen</content-button>
</content-text-block>
</content-split-block>
<content-overlay id="ex-split-film-video" fill="#ex-split-film" label="The film">
<script slot="content" type="text/template">
<content-video fit-container="true" autoplay="true" src="https://www.youtube.com/watch?v=eRsGyueVLvQ"></content-video>
</script>
</content-overlay>h3 {
font-size: 1.5rem;
font-weight: 700;
}
content-split-block {
color: #fff;
background: #0f172a;
}// $ npm install @content-blocks/js
import '@content-blocks/js/components/content-split-block';
import '@content-blocks/js/components/content-image';
import '@content-blocks/js/components/content-text-block';
import '@content-blocks/js/components/content-line';
import '@content-blocks/js/components/content-button';
import '@content-blocks/js/components/content-overlay';
import '@content-blocks/js/components/content-video';<script type="module"
src="https://cdn.jsdelivr.net/npm/@content-blocks/js/dist/content-blocks/content-blocks.esm.js"></script>Anatomy
Content goes into the component's slots, chosen with the slot attribute on each child.
flowchart LR root["#lt;content-split-block#gt;"]:::component root --> s0["<b>slot=#quot;column1#quot;</b><br/>This will be column 1."] root --> s1["<b>slot=#quot;column2#quot;</b><br/>This will be column 2."] classDef component fill:#141413,color:#faf9f5,stroke:#141413
| Slot | What goes in it |
|---|---|
slot="column1" | This will be column 1. |
slot="column2" | This will be column 2. |
Properties
Set them as attributes. Those marked responsive take a value per breakpoint, separated by pipes and named or in order: 1|tablet=2 or 1|2. Seeresponsive values.
| Attribute | Type | Default | Description |
|---|---|---|---|
classesresponsive | String | – | Classes to add to the component. Use pipes for different classes per breakpoint, by name or in order: classes="stacked|laptop=side-by-side". |
columnsresponsive | Number | '1|2' | Not documented yet |
paddingresponsive | String | – | Padding around the component, written as CSS padding. Use pipes for different padding per breakpoint, by name or in order: padding="1rem|tablet=2rem 4rem" or padding="1rem|2rem 4rem|3rem 5rem 4rem". |
reverseresponsive | Boolean | false | Not documented yet |
flowchart LR v["columns=#quot;1|2#quot;"]:::value v --> b0["mobile, from 0px: 1"] v --> b1["tablet and up, from 768px: 2"] classDef value fill:#1d4ed8,color:#fff,stroke:#1d4ed8


