component :: Section

The .section component is the workhorse wrapper marketing pages are made of: a full-width band with vertical rhythm, an optional eyebrow/title/lede header, and background variants.

Why mCSS

Everything is a section

Stack a few of these and you have a landing page.

Section content goes here.

FileDescriptionSource
component.section.cssAll section stylesGithub
Section.astroThe Astro componentGithub
--section-* block in default themeTheme tokens (see table below)Github

Depends on .wrap (global.wrap.css), part of the mCSS core: children align to the same content column as the rest of the page, and the wide preset lets grids escape the reading column.

HTML

<section class="section wrap section-filled">
<header class="section_header">
<p class="section_eyebrow">Why mCSS</p>
<h2 class="section_title">Everything is a section</h2>
<p class="section_lede">Stack a few of these and you have a landing page.</p>
</header>
<!-- content: paragraphs, grids, cards… -->
</section>

Available modifiers

ClassDescription
.sectionDefault. Transparent background, --section-spacing vertical padding.
.section + .section-filledSubtle filled band.
.section + .section-primaryPrimary-colored band; text and links switch to the inverted colors.
.section + .section-wideWidens the content column to --section-wide-width.

Elements

ClassDescription
.section_headerCentered eyebrow/title/lede block.
.section_eyebrowSmall uppercase kicker.
.section_titleThe h2.
.section_ledeIntro paragraph.
.section_actionsCentered, wrapping button row (see the closing-CTA recipe below).

Custom properties

The following custom properties are available in the default theme:

PropertyDescription
--section-spacingVertical padding of the band.
--section-header-spacingSpace between the header and content.
--section-wide-widthContent column width of the wide preset.
--section-eyebrow-colorEyebrow text color.
--section-lede-colorLede text color.
--section-filled-background-colorBackground of the filled variant.
--section-primary-background-colorBackground of the primary variant.
--section-primary-text-colorText color on the primary variant.
--section-primary-link-colorLink color on the primary variant.
--section-primary-link-color-hoverLink hover color on the primary variant.
--section-primary-eyebrow-colorEyebrow color on the primary variant.
--section-primary-lede-colorLede color on the primary variant.

Astro component

PropTypeDefaultDescription
eyebrowstringundefinedSmall uppercase kicker above the title.
titlestringundefinedThe section’s h2.
ledestringundefinedIntro paragraph under the title.
variantstringundefinedfilled, primary.
widthstringundefinedwide.
classstringundefinedAdditional CSS classes, useful for helper classes.

Any other attribute is passed through to the root <section> element (handy for id anchors). The default slot is the section content.

Examples