0

I'm using sass in my project to apply css styling, here i have div items where all div's have same classes except few divs,

example: html

<div class="wrapper-col"><p>jakajsf</p></div>
<div class="wrapper-col"><p>jakajsf</p></div>
<div class="wrapper-col"><p>jakajsf</p></div>
<div class="wrapper-col"><p>jakajsf</p></div>
<div class="wrapper-col not-wrap"><p>jakajsf</p></div>
<div class="wrapper-col"><p>jakajsf</p></div>
<div class="wrapper-col"><p>jakajsf</p></div>
<div class="wrapper-col"><p>jakajsf</p></div>
<div class="wrapper-col"><p>jakajsf</p></div>
<div class="wrapper-col not-wrap"><p>jakajsf</p></div>
<div class="wrapper-col"><p>jakajsf</p></div>

above html has multiple divs with class name wrapper-col,but few div has also class not-wrap, i have scss here in which i want to apply styles having class name wrapper-col but not not-wrap class without modifying HTML

here is what i have tried, but its not working for me.

SCSS:

.wrapper-col{
    &:not(.not-wrap){
        p{
            /* styles here*/
        }
    }
}
1

1 Answer 1

1

The example you pass works fine!

Add a border as an example and you will see it: https://jsfiddle.net/o7hjv1ts/1/

.wrapper-col{
    &:not(.not-wrap){
        p{
            border: 1px solid red;
        }
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.