Thursday, March 28, 2024
HomeCSScss - CSS3: add fashion if there aren't any kids

css – CSS3: add fashion if there aren’t any kids


I am making an attempt to write down a scss selector that may add fashion to the header-cart class however solely when it would not have content material inside.

I can use JS, however I believe it’s doable to write down it in scss.

Earlier than AJAX loaded:

<div class="dropdown-menu dropdown-menu-right header-cart-dropdown">
  <div class="header-cart">
 
  </div>
</div>

After AJAX loaded:

<div class="dropdown-menu dropdown-menu-right header-cart-dropdown">
  <div class="header-cart">
   
    <div class="offcanvas-content-container">
      <div class="offcanvas-cart">
        
      </div>
    </div>
  </div>
</div>

To this point I’ve managed to write down one thing like this, nevertheless it doesn’t work appropriately:

  .dropdown-menu > {
        div {
            &:not(.has-element-loader:has(.offcanvas-content-container)) {
                border: 5px strong inexperienced;
            }
        }
    }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments