JSFiddle - React, Tailwind, and code Playground
by David Sch
HTML
<html>
<head>
</head>
<body>
<div class="banner well notice bg-green">
Close this banner <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$('.close').on("click", function() {
$(this).parents('div').fadeOut();
});
</script>
</body>
</html>
CSS
.banner {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100px;
opacity: 0.6;
color: #ffffff;
text-align: center;
font-family: 'Varela Round', sans-serif;
font-size: 13px;
padding-top: 5px;
}
.close {
color: #fff;
filter: alpha(opacity=20);
font-size: 20px;
font-weight: bold;
line-height: 1;
opacity: .8;
}
.close:hover,
.close:focus {
color: #fff;
cursor: pointer;
filter: alpha(opacity=50);
opacity: 1;
text-decoration: none;
}
button.close {
background: transparent;
border: 0;
cursor: pointer;
padding: 0;
-webkit-appearance: none;
-moz-appearance: none;
}