Title: Section Background CSS Specificity
Last modified: January 19, 2022

---

# Section Background CSS Specificity

 *  [amddtim](https://wordpress.org/support/users/amddtim/)
 * (@amddtim)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/section-background-css-specificity/)
 * The inline CSS generated for Section background is not specific/localized enough
   to just the Section it’s supposed to applied to. For example, if I have a Section
   nested in another Section, and the parent section has a background, the CSS cascades
   down to the child Section because the selector is `.parent-section-id .grids-
   s-w_i:before` rather than only selecting the very next .grids-s-w selector.
 * I resolved this by adding a `>` in between the two css classes in /src/Core/Blocks/
   Section.php line 231, like `$style .= sprintf( '%s > .grids-s-w_i:before {', 
   esc_attr( $selector ) );`
 * Not sure if this is a breaking change elsewhere, but worth considering adding
   to your next version as I’ve patched it locally.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Simone Maranzana](https://wordpress.org/support/users/simo_m/)
 * (@simo_m)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/section-background-css-specificity/#post-15267325)
 * Hi there,
 * thanks for reporting, we are working on a new Grids version in order to make 
   it compatible with the new Site editor. We will definitely take a look at the
   nested sections in order to fix this issue.
 * Best,
 * Simone
 *  Thread Starter [amddtim](https://wordpress.org/support/users/amddtim/)
 * (@amddtim)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/section-background-css-specificity/#post-15295865)
 * This is still not scoped correctly in version >=1.3.0. We have the same issue
   with the css variables, that nested background pseudo elements look up the dom
   tree for the closest declaration of `--grids-section-background`.
 *  Plugin Contributor [Simone Maranzana](https://wordpress.org/support/users/simo_m/)
 * (@simo_m)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/section-background-css-specificity/#post-15296707)
 * Hi there,
 * thanks for reporting, we are working to fix this specificity issue for the next
   update.
 * Regards,
 * Simone

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Section Background CSS Specificity’ is closed to new replies.

 * ![](https://ps.w.org/grids/assets/icon-256x256.png?rev=2048119)
 * [Grids: Layout builder for WordPress](https://wordpress.org/plugins/grids/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/grids/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/grids/)
 * [Active Topics](https://wordpress.org/support/plugin/grids/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/grids/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/grids/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Simone Maranzana](https://wordpress.org/support/users/simo_m/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/section-background-css-specificity/#post-15296707)
 * Status: not resolved