Set width: full 320 480 640 768 1024 1920 custom
<!-- Simple Alert/Message Banner Template -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Alert/Message Banner</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 2rem;
background: #f7f7f7;
}
.alert {
display: flex;
align-items: center;
gap: 1rem;
background: #fffbe6;
color: #664d03;
border: 1px solid #ffe58f;
border-radius: 6px;
padding: 1rem 1.5rem;
box-shadow: 0 2px 8px rgba(0,0,0,0.07);
max-width: 700px;
margin: 0 auto 2rem auto;
font-size: 1rem;
position: relative;
}
.alert-success {
background: #f6ffed;
color: #135200;
border-color: #b7eb8f;
}
.alert-error {
background: #fff1f0;
color: #a8071a;
border-color: #ffa39e;
}
.alert-info {
background: #e6f7ff;
color: #0050b3;
border-color: #91d5ff;
}
.alert-close {
background: none;
border: none;
color: inherit;
font-size: 1.2rem;
cursor: pointer;
position: absolute;
right: 1rem;
top: 1rem;
line-height: 1;
}
@media (max-width: 600px) {
body { padding: 1rem; }
.alert { font-size: 0.95rem; padding: 0.7rem 1rem; }
.alert-close { right: 0.5rem; top: 0.5rem; }
}
</style>
</head>
<body>
<div class="alert alert-info" id="alertBanner">
<span><strong>Info:</strong> This is a simple info message banner. You can use it for notifications or alerts.</span>
<button class="alert-close" id="closeAlert" aria-label="Close">×</button>
</div>
<main style="max-width:700px;margin:0 auto;background:#fff;padding:2rem;border-radius:8px;box-shadow:0 2px 8px rgba(0,0,0,0.07);">
<h1>Simple Alert/Message Banner</h1>
<p>This is a simple, dismissible alert/message banner. You can easily change its style for success, error, or info messages.</p>
</main>
<script>
document.getElementById('closeAlert').onclick = function() {
document.getElementById('alertBanner').style.display = 'none';
};
</script>
</body>
</html>