Below is an HTML layout for a game lobby considering the elements you've mentioned. This layout features a header for the lobby title, sections for available maps, game mode selection, player list, a start game button, and chat functionality. The styles are basic for clarity but can be expanded upon with CSS for a more visually appealing design.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Lobby</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
color: #333;
margin: 0;
padding: 20px;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
}
.section {
margin: 20px 0;
}
.map-preview {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.map {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
margin: 5px;
width: 120px;
text-align: center;
}
.player-list {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
max-height: 150px;
overflow-y: auto;
}
.player {
display: flex;
justify-content: space-between;
padding: 5px;
}
.start-game {
text-align: center;
margin: 20px 0;
}
.start-button {
padding: 10px 20px;
font-size: 16px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.chat {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
max-height: 150px;
overflow-y: auto;
}
</style>
</head>
<body>
<div class="container">
<h1>Game Lobby</h1>
<div class="section">
<h2>Available Maps:</h2>
<div class="map-preview">
<div class="map">Map 1<br><img src="map1-preview.jpg" alt="Map 1" width="100"></div>
<div class="map">Map 2<br><img src="map2-preview.jpg" alt="Map 2" width="100"></div>
<div class="map">Map 3<br><img src="map3-preview.jpg" alt="Map 3" width="100"></div>
</div>
</div>
<div class="section">
<h2>Game Mode Selection:</h2>
<p><strong>Select a mode:</strong></p>
<label>
<input type="radio" name="gameMode" value="co-op"> Co-op
</label>
<label>
<input type="radio" name="gameMode" value="competitive"> Competitive
</label>
</div>
<div class="section">
<h2>Player List:</h2>
<div class="player-list">
<div class="player">Player 1 <span>Ready</span></div>
<div class="player">Player 2 <span>Not Ready</span></div>
<div class="player">Player 3 <span>Ready</span></div>
</div>
</div>
<div class="start-game">
<button class="start-button">Start Game</button>
</div>
<div class="section">
<h2>Chat Functionality:</h2>
<div class="chat">
<p><em>Chat messages will appear here...</em></p>
</div>
<input type="text" placeholder="Type your message..." style="width: 100%; padding: 10px; margin-top: 10px; border: 1px solid #ccc; border-radius: 5px;">
</div>
</div>
</body>
</html>
Explanation:
- The layout is centered and uses a container to keep content within a max-width.
- Each section has headers that clearly define their purpose.
- Map previews are displayed using placeholder images (you'll need to replace them with actual image paths).
- The game mode selection uses radio buttons, allowing users to choose only one mode.
- The player list is displayed with readiness statuses, indicating if each player is ready or not.
- A prominent "Start Game" button is placed for clear visibility.
- Chat functionality includes an area for chat messages and an input field for player messages.
Feel free to customize the layout and styles further to suit your design preferences!