PageTree demo by

Developers

Block styles

The built-in blocks come with a lightweight stylesheet, designed to be overridden by your theme with no effort.

How styles are loaded

Each built-in block loads, with its HTML, a shared stylesheet (base.css) and its own stylesheet, located in plugins/lucaspalomba/pagetree/assets/css/blocks/. On the website, each file is included only once per page. These styles therefore work with any layout, in the preview as well as on the website.

Zero specificity with :where()

All rules are written inside :where(). Their specificity is zero: any rule of your theme, even a simple class selector, wins.

/* In PageTree */
:where(.ptb-btn) { border-radius: var(--ptb-radius); }

/* In your theme: wins without !important */
.ptb-btn { border-radius: 0; }

The --ptb-* variables

Colors and sizes come from CSS custom properties. Redefine them in your theme to adapt all blocks at once:

:root {
    --ptb-primary: #0f766e;        /* buttons, "Primary color" backgrounds */
    --ptb-primary-contrast: #fff;
    --ptb-secondary: #475569;
    --ptb-light: #f3f4f6;          /* light backgrounds */
    --ptb-dark: #1f2937;           /* dark backgrounds */
    --ptb-radius: 0.5rem;
    --ptb-gap: 1.5rem;
    --ptb-space-s: 1rem;           /* Small / Medium / Large / Extra large spacing */
    --ptb-space-m: 2rem;
    --ptb-space-l: 4rem;
    --ptb-space-xl: 6rem;
    --ptb-container: 1200px;       /* width of a "Centered" section */
}

Full list of variables and default values:

VariableDefaultUsage
--ptb-primary#2563ebPrimary color (buttons, backgrounds)
--ptb-primary-contrast#ffffffText on the primary color
--ptb-secondary#475569Secondary color
--ptb-secondary-contrast#ffffffText on the secondary color
--ptb-light#f3f4f6"Light" background
--ptb-light-contrastinheritText on a light background
--ptb-dark#1f2937"Dark" background
--ptb-dark-contrast#ffffffText on a dark background
--ptb-borderrgba(0, 0, 0, 0.12)Borders
--ptb-mutedrgba(0, 0, 0, 0.6)Secondary text
--ptb-radius0.5remCorner radius
--ptb-gap1.5remSpace between items
--ptb-space-s to --ptb-space-xl1rem, 2rem, 4rem, 6remSpacing sizes
--ptb-container1200pxWidth of a "Centered" section

The gallery also uses --ptb-gallery-columns and --ptb-gallery-gap.

The ptb-* classes

The block HTML uses classes prefixed with ptb-, following the block / element / modifier convention. You can target them directly:

ClassElement
.ptbShared block wrapper
.ptb-btn, .ptb-btn--primary, .ptb-btn--secondary, .ptb-btn--outline, .ptb-btn--linkButtons and their styles
.ptb-btn--s, .ptb-btn--m, .ptb-btn--lButton sizes
.ptb-theme--light, .ptb-theme--dark, .ptb-theme--primaryColored backgrounds
.ptb-align--left, --center, --rightText alignment
.ptb-section, .ptb-section__inner, .ptb-section__grid, .ptb-section__cellSection and its columns
.ptb-hero, .ptb-hero__title, .ptb-hero__subtitleHero banner
.ptb-card, .ptb-cardsCards
.ptb-gallery, .ptb-lightboxGallery and lightbox
.ptb-accordion__item, .ptb-accordion__questionQuestions / answers

Each block has its own classes (.ptb-quote, .ptb-files__list, .ptb-mediatext, .ptb-video…). For the exact list, see the files in the plugin's assets/css/blocks/ folder.

Buttons are links. A theme rule such as a { color: … } wins over the block styles, which have zero specificity: the text of a button can then take the color of your links. Give .ptb-btn--primary and the other styles their own colors in your theme.

.ptb-btn--primary,
.ptb-btn--primary:hover {
    color: var(--ptb-primary-contrast);
}

Example: matching your brand guidelines

:root {
    --ptb-primary: #b91c1c;
    --ptb-radius: 0;
    --ptb-container: 1080px;
}

.ptb-hero__title {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}