I have a section
below my form that will show an alert message if there is an error.
The issue I am facing is that if I use the inline-block
property, everything within the section
will be displayed in the alert color.
I specifically want the background-color: red;
to only appear when the section is not empty.
section#error-block {
height: 15px;
clear: both;
}
.error-alert {
display: inline-block;
color: #fff;
background-color: #f00;
height: 20px;
width: 100%;
clear: both;
}
<section id="error-block">
<span class="error-alert">{email_error}</span>
</section>