Here's the HTML and external CSS code for a browser start page with multiple links organized by categories. These categories appear as clickable headings that produce an accordion effect:
HTML (index.html):
html Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Start Page</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<div class="group">
<button class="accordion">Category 1</button>
<div class="panel">
<ul>
<li><a href="https://www.example-link1.com">Example Link 1</a></li>
<li><a href="https://www.example-link2.com">Example Link 2</a></li>
</ul>
</div>
</div>
<div class="group">
<button class="accordion">Category 2</button>
<div class="panel">
<ul>
<li><a href="https://www.example-link3.com">Example Link 3</a></li>
<li><a href="https://www.example-link4.com">Example Link 4</a></li>
</ul>
</div>
</div>
<div class="group">
<button class="accordion">Category 3</button>
<div class="panel">
<ul>
<li><a href="https://www.example-link5.com">Example Link 5</a></li>
<li><a href="https://www.example-link6.com">Example Link 6</a></li>
</ul>
</div>
</div>
</div>
<script src="scripts.js"></script>
</body>
</html>
CSS (styles.css):
css Copy code
body {
font-family: Arial, sans-serif;
background-color: #151515;
color: #f9f9f9; /* Monaspace color scheme background */
margin: 0;
padding: 0;
}
.container {
width: 80%;
margin: auto;
padding-top: 50px;
}
.group {
border-top: 1px solid #2e2e2e;
padding: 10px 0;
}
.accordion {
background-color: #1e1e1e; /* Monaspace color scheme header */
color: #f9f9f9; /* Monaspace color scheme text */
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.accordion:after {
content: '\002B'; /* Unicode plus sign */
color: #f4f4f4;
font-weight: bold;
float: right;
margin-left: 5px;
}
.accordion.active:after {
content: "\2212"; /* Unicode minus sign */
}
.panel {
padding: 0 18px;
background-color: #2e2e2e;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.panel ul {
list-style-type: none;
padding-left: 0;
}
.panel ul li {
padding: 8px 0;
}
.panel ul li a {
color: #66d9ef;
text-decoration: none;
}
.panel ul li a:hover {
text-decoration: underline;
}
JavaScript (scripts.js):
js Copy code
document.addEventListener("DOMContentLoaded", function () {
const acc = document.getElementsByClassName("accordion");
for (let i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function () {
this.classList.toggle("active");
/* Toggle between hiding and showing the active panel */
const panel = this.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
}
});
Summary
The HTML consists of a container that includes grouped links under clickable accordion headers.
The CSS styles the accordion header, panel, and links with Monaspace colors and implements the accordion effect using transitions.
The JavaScript handles the accordion toggle functionality.
Save these as index.html, styles.css, and scripts.js respectively, and make sure all the files are in the correct location for proper referencing.