NeonRant
10/3/2019 - 12:24 AM

Conditional CSS

You can apply a style conditionally depending on if other elements are present. Thisdoesn't need an if else, but instead, create a style that expects a combination of elements. If one of those elements are not present, then the style isnot applied. This is useful if you want to appl a style based on if say, a header image is displayed or not.

The style below will only be applied if the sibling element with the classes header-24-sub.bg-midnight-blue is present above it. If it is not, then the style does not apply. If it is, then the style is applied to the element that is selected with this style. (The element that uses the .faq-conntent class that is a sibling of the .header~~~ cla)

.header-24-sub.bg-midnight-blue + .faq-content{
margin-top: "20px";
}