Edit This Code:
<!DOCTYPE html>
<html>
<head>
<style>
.alert {
    padding: 20px;
    background-color: #f44336;
    color: white;
}


.closebtn {
    margin-left: 15px;
    color: white;
    font-weight: bold;
    float: right;
    font-size: 22px;
    line-height: 20px;
    cursor: pointer;
}


.closebtn:hover {
    color: black;
}

</style>
</head>
<body>

<h2>Alert Messages</h2>

<p>Click on the "x" symbol to close the alert message.</p>
<div class="alert">
  <span class="closebtn" onclick="this.parentElement.style.display='none';">×</span>
  <strong>Danger!</strong> Indicates a dangerous or potentially negative action.
</div>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy