I'm facing a slight issue with SCSS syntax while creating a small component using the BEM methodology. Here's the HTML:
<div class="message message--success">
<div class="message__title">
BEM Example
</div>
<div class="message__content">
<p>BEM Example text</p>
</div>
</div>
Here's the SCSS code:
.message {
display: block;
width: 300px;
border-radius: 5px;
border: 2px solid #000;
padding: 10px;
&__title {
font-size: 18px;
line-height: 1;
color: #000;
margin-bottom: 10px;
}
&__content {
font-size: 15px;
color: #000;
}
&--success {
border-color: #3f9442;
&__title {
color: #3f9442;
}
&__content {
color: #3f9442;
}
}
}
In the code above, the .message--success class applies direct styles (like border-color), but styling for title and content doesn't. How can I target .message as the parent for &__title and &__content within &--success?