Text Alignment Inheritance Extension

Overview

The Text Alignment Inheritance Extension allows child blocks to automatically inherit text alignment settings from their parent container blocks. This ensures consistent text alignment throughout nested block structures without manually setting alignment on each individual block.

Key Features

  • Automatic Inheritance: Child blocks inherit parent alignment
  • Override Capability: Child blocks can override inherited alignment
  • Cascading Support: Works through multiple nesting levels
  • Works with All Blocks: Compatible with any WordPress block
  • Editor Preview: See inherited alignment in the editor
  • No Configuration Needed: Works automatically

How It Works

  1. Set text alignment on a parent container (Section, Group, Row, Grid)
  2. Add child blocks inside the container
  3. Child blocks automatically inherit the parent alignment
  4. Optionally override alignment on specific child blocks

Supported Alignments

  • Left: Text aligned to the left edge
  • Center: Text centered horizontally
  • Right: Text aligned to the right edge
  • Justify: Text stretched to edges (if supported)

Common Use Cases

  • Centered Sections: Set parent to center, all content centers automatically
  • Hero Sections: Center-align all hero content with one setting
  • Footer Columns: Set different alignments per column
  • Card Content: Consistent alignment within cards
  • Feature Grids: Uniform alignment across grid items

Best Practices

  • Set alignment on the outermost container for consistency
  • Override only when necessary for specific elements
  • Use center alignment for hero and CTA sections
  • Left-align for long-form reading content
  • Right-align sparingly for design emphasis
  • Test on mobile – centered text may need adjustment

Override Examples

Centered Section with Left-Aligned Text

  • Parent Section: Center aligned (centers content blocks)
  • Paragraph blocks: Override to left for better readability
  • Heading: Keep centered (inherits from parent)
  • Button: Keep centered (inherits from parent)

Inheritance Chain

Alignment inheritance works through multiple levels:

  • Section (center) > Row (inherits center) > Paragraph (inherits center)
  • Section (left) > Group (override to center) > Heading (inherits center from Group)

Accessibility

  • Avoid full justification – can create awkward spacing
  • Left-align for better readability in most languages
  • Center-align sparingly for short text only
  • Ensure alignment does not affect reading flow

Troubleshooting

  • Alignment not inheriting: Check parent has alignment set
  • Wrong alignment: Check for overrides on child blocks
  • Inconsistent alignment: Verify inheritance chain