Skip to content

Instantly share code, notes, and snippets.

@kirkegaard
Created July 30, 2025 13:02
Show Gist options
  • Save kirkegaard/c0991e0cb37c0e173c452dfe2b08c9a1 to your computer and use it in GitHub Desktop.
Save kirkegaard/c0991e0cb37c0e173c452dfe2b08c9a1 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>chat</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: Arial, sans-serif;
background-color: #111;
color: #fff;
}
.container {
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
padding: 1rem;
}
.messages {
display:flex;
flex-direction: column-reverse;
flex: 1;
overflow-y: auto;
margin: 1rem 0;
}
.message {
display: flex;
flex-direction: column;
margin: 1rem 0;
.header {
font-size: 0.8rem;
}
.body {
width: fit-content;
margin-top: 0.5rem;
padding: 1rem;
border-radius: 2rem;
background-color: rgba(255, 255, 255, 0.1);
}
&.me {
align-items: flex-end;
.header {
display:none;
}
.body {
background-color: rgba(0, 123, 255, 0.2);
}
}
}
.input {}
.input-group {
display: flex;
> * {
padding: 1rem;
border: none;
border-radius: 1rem;
transition: background-color 0.3s ease-out;
}
> *:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
> *:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
input {
flex: 1;
background-color: rgba(255, 255, 255, 0.1);
color: #fff;
}
input:focus {
outline: none;
background-color: rgba(255, 255, 255, 0.2);
}
button {
background-color: #007bff;
color: #fff;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
}
</style>
</head>
<body>
<div class="container">
<div class="messages">
<div class="message me">
<div class="header">
<span class="username">User1</span>
</div>
<div class="body">Thats great!</div>
</div>
<div class="message">
<div class="header">
<span class="username">User3</span>
</div>
<div class="body">Im also great</div>
</div>
<div class="message">
<div class="header">
<span class="username">User2</span>
</div>
<div class="body">I'm good, thanks! How about you?</div>
<div class="body">And what about the kids?</div>
</div>
<div class="message me">
<div class="header">
<span class="username">User1</span>
</div>
<div class="body">Hello! How are you today?</div>
<div class="body">I hope everything is going well.</div>
</div>
</div>
<div class="input">
<div class="input-group">
<input type="text" class="message-input" placeholder="Type your message here...">
<button class="send-button">Send</button>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment