skip to Main Content

Select element not preceded by another in CSS

Consider this snippet: .wrapper { display: flex; gap: 5px; border: 1px solid black; border-radius: 3px; width: 80px; padding: 5px; } <div class="wrapper"> <div class="icon">🖼️</div> <div class="text">paintings</div> </div> The icon may or may not be present. What I'm trying to achieve…

VIEW QUESTION

Css – not able to target element

I have HTML Like this <element1 class="class__1"> <element2 removePadding></element2> <element3 class="class-3"></element3> </element> I want to change the margin-bottom of class-3 only when element2 has removePadding attribute, I tried like this element1 element2[removePadding] element1 element3.class-3 { margin-top: 20px; } but this…

VIEW QUESTION
Back To Top
Search