Creating a browser start page with multiple links categorized into groups with an accordion effect can be a very useful way to keep your most frequently visited websites organized and easily accessible. Here's a simple example of how you can achieve this using HTML, CSS, and a bit of JavaScript:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Browser Start Page</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="accordion">
<div class="accordion-item">
<h3 class="accordion-header">Category 1</h3>
<div class="accordion-content">
<ul>
<li><a href="https://example.com">Example 1</a></li>
<li><a href="https://example.com">Example 2</a></li>
<li><a href="https://example.com">Example 3</a></li>
</ul>
</div>
</div>
<div class="accordion-item">
<h3 class="accordion-header">Category 2</h3>
<div class="accordion-content">
<ul>
<li><a href="https://example.com">Example 4</a></li>
<li><a href="https://example.com">Example 5</a></li>
<li><a href="https://example.com">Example 6</a></li>
</ul>
</div>
</div>
<div class="accordion-item">
<h3 class="accordion-header">Category 3</h3>
<div class="accordion-content">
<ul>
<li><a href="https://example.com">Example 7</a></li>
<li><a href="https://example.com">Example 8</a></li>
<li><a href="https://example.com">Example 9</a></li>
</ul>
</div>
</div>
</div>
<script src="scripts.js"></script>
</body>
</html>
CSS (styles.css)
body {
font-family: Arial, sans-serif;
}
.accordion {
display: flex;
justify-content: space-between;
gap: 1rem;
}
.accordion-item {
flex: 1;
border: 1px solid #ccc;
border-radius: 5px;
overflow: hidden;
}
.accordion-header {
background-color: #f1f1f1;
padding: 1rem;
margin: 0;
cursor: pointer;
}
.accordion-content {
display: none;
padding: 1rem;
border-top: 1px solid #ccc;
}
.accordion-content ul {
list-style: none;
padding: 0;
}
.accordion-content li {
padding: 5px 0;
}
.accordion-content a {
text-decoration: none;
color: #007BFF;
}
.accordion-content a:hover {
text-decoration: underline;
}
JavaScript (scripts.js)
document.querySelectorAll('.accordion-header').forEach(header => {
header.addEventListener('click', () => {
const content = header.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
document.querySelectorAll('.accordion-content').forEach(item => {
item.style.display = "none";
});
content.style.display = "block";
}
});
});
Instructions
- Create a New Project Folder: Create a new folder on your computer and name it appropriately.
- Create HTML File: Inside the new folder, create a file named
index.html and paste the HTML code into it.
- Create CSS File: Create a file named
styles.css in the same folder and paste the CSS code into it.
- Create JavaScript File: Create a file named
scripts.js in the same folder and paste the JavaScript code into it.
- Open the HTML File: Open
index.html in your browser to see the start page in action.
With this setup, you have a simple browser start page with multiple links organized into categories, each in an accordion style. Feel free to modify the content, style, and layout to fit your needs.