* {
outline: 1px solid red;
outline-offset: -1px;
}
<div id="hide_forever">
Div, который прячется навсегда
</div>
<button id="button1">Скрыть DIV</button>
<script>
const div = document.getElementById('hide_forever');
const button = document.getElementById('button1');
const status = localStorage.getItem('div_hidden');
if (status) {
div.style.display = 'none';
}
button.addEventListener('click', () => {
localStorage.setItem('div_hidden', '1');
div.style.display = 'none';
});
</script>
<h1>
Hi there! We are the new kids on the block
and we build awesome websites and mobile apps.
</h1>
h1 {
max-width: 600px; // Подобрать, чтобы текст не расползался по всей ширине
margin-left: auto;
margin-right: auto;
text-align: center;
}