Global Styles: Elements support tracking issue #40966
Labels
[Feature] Themes
Questions or issues with incorporating or styling blocks in a theme.
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
Needs Dev Note
Requires a developer note for a major WordPress release cycle
[Type] Tracking Issue
Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
What are elements?
Elements are a representation of HTML primitives that be used inside blocks. Some examples include
link
,heading
andbutton
.Why use elements?
Many different blocks can use the same elements. By using elements inside blocks we make it possible for all elements to share the same styles regardless of what block they are in. This is powerful for elements like buttons and form fields which are used in many different blocks. If block developers use the elements in their blocks then themers and users will be able to ensure that all blocks have matching styles without using CSS.
What's the difference between an element and a block?
Elements can be used exist in many different blocks - they can be the things that blocks are built from, although not exclusively. For example the Button block uses a button element, as does the Search block and File block.
Which styles win, the block styles or the element styles?
Elements are lower down in priority order, so block styles will take precedence. This means you can have consistent styles across all buttons on your site with the exception of one particular block.
Will blocks have to use elements?
No. Blocks are free to output whatever HTML they like, but we’d encourage block builders to use elements where they exist so that themes can control their appearance.
This is a tracking issue for adding support for more elements to Global Styles. Currently only headings and links are supported and there's not a full UI for them:
elements
selector is not applied #36731The text was updated successfully, but these errors were encountered: