Good afternoon, please help me fix the HTML code so that the message appears on the mobile version. On the computer version of the site, the message is displayed.
<!DOCTYPE html>
<html lang="uk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Акційне повідомлення</title>
<style>
.popup {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
max-width: 400px;
background: #fff;
padding: 20px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
border-radius: 10px;
z-index: 1000;
display: none;
text-align: center;
}
.popup h2 {
margin: 0 0 10px;
}
.popup button {
background: #ff4500;
color: #fff;
border: none;
padding: 10px;
cursor: pointer;
border-radius: 5px;
}
.popup-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
display: none;
z-index: 999;
}
@media (max-width: 480px) {
.popup {
width: 90%;
}
}
</style>
</head>
<body>
<div class="popup-overlay" id="popupOverlay"></div>
<div class="popup" id="popup">
<h2>Спеціальна пропозиція!</h2>
<p>Отримайте знижку 20% на всі товари цього тижня!</p>
<button onclick="closePopup()">Закрити</button>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
setTimeout(function () {
document.getElementById("popup").style.display = "block";
document.getElementById("popupOverlay").style.display = "block";
}, 2000); // Затримка 2 секунди
});
function closePopup() {
document.getElementById("popup").style.display = "none";
document.getElementById("popupOverlay").style.display = "none";
}
</script>
</body>
</html>