71 lines
2.0 KiB
HTML
71 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>{{ this.title }}</title>
|
|
<style>
|
|
body, html {
|
|
height: 100%;
|
|
margin: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-direction: column;
|
|
}
|
|
#topbar {
|
|
width: 100%;
|
|
text-align: center;
|
|
border-bottom: 1px solid black;
|
|
}
|
|
.button {
|
|
display: inline-block;
|
|
padding: 10px;
|
|
border-right: 1px solid black;
|
|
transition: background-color 0.5s;
|
|
}
|
|
.button:hover {
|
|
background-color: #888;
|
|
}
|
|
.content {
|
|
max-width: 80%;
|
|
text-align: justify;
|
|
}
|
|
h1 {
|
|
text-align: left;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="topbar">
|
|
<div class="button">Button 1</div>
|
|
<div class="button">Button 2</div>
|
|
<div class="button">Button 3</div>
|
|
<!-- Add more buttons as needed -->
|
|
</div>
|
|
|
|
<div class="content">
|
|
<h1>{{ this.title }}</h1>
|
|
{{ this.body }}
|
|
</div>
|
|
|
|
<script>
|
|
document.body.addEventListener('click', function () {
|
|
var randomColor = 'rgb(' +
|
|
Math.floor(Math.random() * 256) + ',' +
|
|
Math.floor(Math.random() * 256) + ',' +
|
|
Math.floor(Math.random() * 256) + ')';
|
|
document.body.style.backgroundColor = randomColor;
|
|
document.getElementById('topbar').style.backgroundColor = randomColor;
|
|
});
|
|
var buttons = document.querySelectorAll('.button');
|
|
buttons.forEach(function(button) {
|
|
button.addEventListener('click', function() {
|
|
var randomColor = 'rgb(' +
|
|
Math.floor(Math.random() * 256) + ',' +
|
|
Math.floor(Math.random() * 256) + ',' +
|
|
Math.floor(Math.random() * 256) + ')';
|
|
this.style.backgroundColor = randomColor;
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |