Great extension! You're envisioning <aside> elements with a third placement mode: aside-position: end, where:
- All asides marked
end (or when viewport too narrow for side placement) get moved to the bottom of the container,
- Rendering acts like footnotes or endnotes,
- And there's an automatic or manual internal linking mechanism from the main content to those footnotes.
This is a neat progressive enhancement pattern (responsive & semantic) and a clever approach to lightweight footnoting!
How to implement this concept with current CSS + minimal HTML/JS
1. Your requirements:
- Asides with
aside-position: left or right appear side-by-side (as above).
- Asides with
aside-position: end appear at the bottom of the block (article/section).
- If the viewport width is too narrow for an aside's width, it automatically behaves as
aside-position: end.
- A link in the main content to the footnote reference (optional, but good UX).
- Ideally, no heavy JS footnote system—just basic markup + CSS responsiveness.
2. HTML Structure & Markup strategy
<article class="content-block">
<aside class="boxout left" id="aside1" data-position="left" style="--aside-width:200px;">Left aside 1</aside>
<aside class="boxout right" id="aside2" data-position="right" style="--aside-width:200px;">Right aside 1</aside>
<p>
This is some main content with a footnote reference
<a href="#aside-3" class="footnote-ref" aria-describedby="footnote-label" title="See footnote 3">[3]</a>.
</p>
<aside class="boxout end" id="aside-3" data-position="end" style="--aside-width:200px;">
<span id="footnote-label" class="visually-hidden">Footnote 3</span>
This is the footnote content that appears at the end.
</aside>
</article>
3. CSS layout for left/right/end behavior
.content-block {
display: flex;
flex-wrap: wrap;
gap: 1rem;
position: relative;
}
/* Left and right asides -- same as before */
.boxout.left {
order: 0;
width: var(--aside-width, 200px);
align-self: flex-start;
}
.boxout.right {
order: 2;
width: var(--aside-width, 200px);
align-self: flex-start;
}
/* Main content flows and takes available space */
.content-block > p {
order: 1;
flex: 1 1 auto;
min-width: 300px;
}
/* -- New for end asides -- */
.boxout.end {
order: 3; /* After main + LEFT/RIGHT */
width: 100%; /* full width at bottom */
background: #f9f9f9;
border-left: 4px solid #888;
padding: 0.5em 1em;
font-size: 0.9rem;
margin-top: 2em;
box-sizing: border-box;
}
/* Responsive: At small viewports, all left/right asides become "end" visually */
@media (max-width: 740px) {
.boxout.left, .boxout.right {
order: 3;
width: 100% !important;
align-self: stretch;
margin-top: 1.5em;
}
.content-block {
flex-direction: column;
}
}
4. Mimicking "aside-position: end" auto-switch on narrow screens
Since CSS doesn’t have conditional property switches for custom properties, the best we can do is override styles on narrow viewports:
- On small screens, left/right asides become block, full width, flow vertically at the bottom with
order:3.
- On wide screens, they remain fixed side boxes with
order: 0 or 2 respectively.
This mimics “auto-switching” behavior on resize.
5. Internal Footnote Links UX
The footnote reference in the text:
<a href="#aside-3" class="footnote-ref" aria-describedby="footnote-label" title="See footnote 3">[3]</a>
- Points to the footnote
<aside id="aside-3">.
- Screen readers get semantic label from visually hidden span inside the footnote.
- Users can click and jump to footnote.
- You can add "Back to reference" links in footnotes if you want.
Optional enhancement to footnote (define an anchor back):
<aside id="aside-3" class="boxout end" data-position="end" style="--aside-width:200px;">
<span id="footnote-label" class="visually-hidden">Footnote 3</span>
This is the footnote content <a href="#ref-3" class="footnote-backlink">↩</a>
</aside>
And in the main text:
<p>This is some main content with a footnote reference
<a href="#aside-3" class="footnote-ref" id="ref-3" aria-describedby="footnote-label" title="See footnote 3">[3]</a>.
</p>
6. JavaScript optional enhancement — dynamic footnote collation
If you want to automate collating all aside[data-position="end"] into a common footnotes section at the bottom (instead of interspersed in the content), a tiny script can:
- Find all
aside[data-position="end"] inside a container
- Remove them from their place,
- Append them to a
.footnotes container at the bottom dynamically.
Example:
document.addEventListener('DOMContentLoaded', () => {
const article = document.querySelector('.content-block');
if (!article) return;
// Create footnotes container
let footnotesContainer = article.querySelector('.footnotes');
if (!footnotesContainer) {
footnotesContainer = document.createElement('section');
footnotesContainer.className = 'footnotes';
article.appendChild(footnotesContainer);
}
const endAsides = [...article.querySelectorAll('aside[data-position="end"]')];
endAsides.forEach(aside => {
footnotesContainer.appendChild(aside);
});
});
Add some CSS styling:
.footnotes {
margin-top: 3rem;
border-top: 1px solid #ccc;
padding-top: 1rem;
}
Summary
| Feature | Approach |
|---|
| `aside-position: left | right` |
aside-position: end footnotes | order:3, 100% width at container bottom |
| Auto-switch to end on narrow screen | CSS media query overrides to block layout |
| Internal footnote links | <a href="#asideID"> linking + visually hidden labels |
| Collating end asides to a single container | Optional small JS script |
If you want, I can prepare a full minimal working example with all this implemented. Would you like that?