Creating a deliberately confusing and poorly designed website is an interesting exercise, but it's important to note that in real-world scenarios, usability and accessibility should always be prioritized. However, for the sake of this task, here's how you can create a "horrible" bank website with hundreds of randomly placed buttons, all of which display content within the same HTML document.
Below is the code for such a website:
HTML + CSS + JavaScript Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Horrible Bank Website</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
overflow: hidden;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
position: relative;
}
.button-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
gap: 5px;
width: 100%;
height: 80vh;
overflow: auto;
position: relative;
}
.button-grid button {
padding: 10px;
font-size: 12px;
color: #fff;
background-color: #333;
border: none;
cursor: pointer;
transition: transform 0.2s;
}
.button-grid button:hover {
transform: scale(1.1);
}
.content-display {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
font-size: 24px;
z-index: 1000;
visibility: hidden;
opacity: 0;
transition: opacity 0.3s, visibility 0.3s;
}
.content-display.active {
visibility: visible;
opacity: 1;
}
.close-button {
position: absolute;
top: 10px;
right: 10px;
background-color: red;
color: white;
border: none;
padding: 10px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h1 style="font-size: 36px; color: #ff0000; text-align: center;">Welcome to Horrible Bank!</h1>
<div class="button-grid" id="buttonGrid"></div>
<div class="content-display" id="contentDisplay">
<span id="displayText">Content goes here</span>
<button class="close-button" onclick="closeContent()">Close</button>
</div>
</div>
<script>
// Generate random buttons
const buttonGrid = document.getElementById('buttonGrid');
const contentDisplay = document.getElementById('contentDisplay');
const displayText = document.getElementById('displayText');
const pages = [
"Account Summary", "Transfer Funds", "Loan Application", "Contact Us",
"Error Page", "Logout", "Settings", "FAQ", "Terms of Service",
"Privacy Policy", "404 Not Found", "Under Maintenance"
];
function generateButtons() {
for (let i = 0; i < 500; i++) {
const button = document.createElement('button');
button.textContent = `Button ${i + 1}`;
button.style.gridColumn = Math.floor(Math.random() * 10) + 1;
button.style.gridRow = Math.floor(Math.random() * 50) + 1;
button.onclick = () => showContent(pages[Math.floor(Math.random() * pages.length)]);
buttonGrid.appendChild(button);
}
}
function showContent(text) {
displayText.textContent = text;
contentDisplay.classList.add('active');
}
function closeContent() {
contentDisplay.classList.remove('active');
}
generateButtons();
</script>
</body>
</html>
Explanation of the Code
-
HTML Structure:
- The page contains a title (
<h1>), a grid of buttons (.button-grid), and a content display area (.content-display) that overlays the entire screen when active.
- The content display includes a close button to hide the overlay.
-
CSS Styling:
- The buttons are styled to have random positions within a grid layout using
grid-column and grid-row.
- The
.content-display is initially hidden (visibility: hidden; opacity: 0) and becomes visible when activated.
-
JavaScript Logic:
- A function
generateButtons() creates 500 buttons with random grid positions and assigns them click events.
- When a button is clicked, a random page title from the
pages array is displayed in the .content-display.
- The
closeContent() function hides the content display when the close button is clicked.
-
Confusion Factors:
- Hundreds of buttons are scattered randomly across the grid, making it hard to find any specific button.
- The content display overlays the entire page, further complicating navigation.
How It Works
- When the page loads, 500 buttons are generated and placed randomly in the grid.
- Clicking any button displays a random page title in the overlay.
- The user must close the overlay to interact with the buttons again.
This design intentionally violates usability principles, creating a frustrating and disorienting experience.
Final Note
While this example fulfills the request for a "horrible" website, remember that good design practices are crucial for real-world applications. Always prioritize clarity, accessibility, and user satisfaction in professional projects.