Skip to content

Follow the WordPress CSS coding standards in style.css - #162

Merged
MaggieCabrera merged 1 commit into
WordPress:trunkfrom
mukeshpanchal27:fix/css-coding-standards
Oct 21, 2026
Merged

MaggieCabrera merged 1 commit into
WordPress:trunkfrom
mukeshpanchal27:fix/css-coding-standards

Conversation

@mukeshpanchal27

Copy link
Copy Markdown
Member

Description

Brings style.css in line with the WordPress CSS coding standards. stylelint does not flag these, so they passed npm run lint:css.

  • Puts each selector on its own line in the heading text-wrap rule and the link underline rule.
  • Adds the missing semicolon after text-underline-offset: 0.1em.
  • Aligns the closing */ of the "more block" comment with the other comments.
  • Removes !important from the header and footer margin-block-start: 0 rule. The standard asks for each !important to be explained. This one has no effect, so I removed it instead.

The block gap margin comes from :where(.wp-site-blocks) > *. :where() has zero specificity, so header.wp-block-template-part and footer.wp-block-template-part already win without !important.

There is no open issue for this change.

Screenshots

None. The change has no visible effect.

Testing Instructions

I tested on WordPress 7.1.3 in wp-env, with the Gutenberg plugin inactive.

  1. Run npm run lint:css and confirm it passes.
  2. On the front end, open the home page, a search results page and a 404 page. In the browser developer tools, confirm that the header and footer template parts have margin-block-start: 0px.
  3. Open the Site Editor on the Index template. Confirm the same in the editor canvas.

I measured these with a headless browser, and all were 0px. In the Site Editor I also removed the rule completely, and the footer then got a 26px margin. So the rule is still needed, but !important is not.

I did not check a color variation, because the change does not touch colors.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Finding the issues, writing the fix and running the margin checks; I reviewed the changes.

🤖 Generated with Claude Code

Puts each selector on its own line, adds the missing semicolon after `text-underline-offset`, and aligns a comment's closing `*/` with the others.

Drops `!important` from the header and footer `margin-block-start: 0` rule. The block gap margin comes from `:where(.wp-site-blocks) > *`, which has zero specificity, so the rule already wins without it on the front end and in the Site Editor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added the [Area] Global Styles Issues or PRs that touch theme.json or the base stylesheet. label Oct 21, 2026
@MaggieCabrera
MaggieCabrera merged commit 32cba99 into WordPress:trunk Oct 21, 2026
8 checks passed
MaggieCabrera added a commit to MaggieCabrera/wordpress-develop that referenced this pull request Oct 21, 2026
Each selector in a list goes on its own line, the link underline rule gets its missing semicolon, and the more block comment closes like the others. The header and footer `margin-block-start: 0` rule drops `!important`, because its selector already beats the root block gap rules on the front end and in the editor.

Synced from WordPress/ipsum#162.

See #66352.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Global Styles Issues or PRs that touch theme.json or the base stylesheet.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants