Add an alert message to your page
Add an alert message to your page
Written by Aleks
Updated over a week ago
<div class="alert">
<span class="closebtn" onclick="this.parentElement.style.display='none';">×</span>
This is an alert box.
</div>
/* The alert message box */
.alert {
padding: 20px;
background-color: #f44336; /* Red */
color: white;
margin-bottom: 15px;
}
/* The close button */
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
/* When moving the mouse over the close button */
.closebtn:hover {
color: black;
}