

Create a Chatbox UI Template using HTML and CSS
source link: https://www.geeksforgeeks.org/create-a-chatbox-ui-template-using-html-and-css/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Create a Chatbox UI Template using HTML and CSS
Real-time chat applications are designed to provide a responsive and interactive experience, where messages are delivered and displayed immediately as they are sent. This means that users can engage in conversations and receive updates in real-time, without significant delays.
In the chat application UI, received messages display left aligned and sent messages display right aligned. Also, the avatar image (or image) is displayed before the sent and received messages. Here, we will design a Chatbox UI using HTML and CSS.
Example:
<!DOCTYPE html> < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < style > .chat-container { max-width: 600px; margin: 50px auto; background-color: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .message-container { display: flex; flex-direction: column; } .message { padding: 10px; margin: 10px; border-radius: 5px; max-width: 70%; word-wrap: break-word; display: flex; align-items: center; } .sender-message { background-color: #e0e0e0; color: #000; align-self: flex-start; } .receiver-message { background-color: #4CAF50; color: #fff; align-self: flex-end; } .avatar { width: 30px; height: 30px; border-radius: 50%; margin-right: 10px; } .message input { width: calc(100% - 20px); padding: 8px; margin: 10px; border: 1px solid #ddd; border-radius: 5px; } .message button { padding: 8px; margin: 10px; background-color: #4CAF50; color: #fff; border: none; border-radius: 5px; cursor: pointer; } </ style > < title >Chat Template UI using HTML and CSS</ title > </ head > < body > < div class = "chat-container" > < div class = "message-container" > < div class = "message sender-message" > < img src = alt = "Sender Avatar" class = "avatar" > Hello there! </ div > < div class = "message receiver-message" > < img src = alt = "Receiver Avatar" class = "avatar" > Hi! How can I help you today? </ div > < div class = "message sender-message" > < img src = alt = "Sender Avatar" class = "avatar" > I have a question about your products. </ div > < div class = "message receiver-message" > < img src = alt = "Receiver Avatar" class = "avatar" > Sure, feel free to ask! </ div > </ div > < div class = "message" > < input type = "text" placeholder = "Type your message..." > < button >Send</ button > </ div > </ div > </ body > </ html > |
Output:

Recommend
-
7
Thinking Outside the Chatbox
-
4
Creating a chat function in your app can be a long and difficult process, thankfully the TalkJS chat API makes that easy, we can even customise it to make it look in keeping with our app. We'll explore how we...
-
24
How To Create a Shopping Cart UI Using HTML & CSS?Step by step tutorialThe shopping cart page is designed to allow buyers to see all the products they have added to the shopping cart. It c...
-
7
Create a Portfolio Website Using HTML, CSS, JavaScript Aug 15 ・1 min read
-
12
Responses
-
6
Custom template html / css bootstrap for wordpress advertisements I have a custom bootstrap webpage created wit...
-
8
还在苦恼于chatgpt的卡顿吗?还在担心前端调用api导致泄露吗?还在苦恼于各种机器翻译的智障结果吗?今天给大家介绍两个开源的chatgpt神器,灰常好用。以下内容来自官方项目文档。
-
4
推荐一个ChatGPT桌面客户端:Chatbox By
-
11
Add AI Chatbox to your VitePress documentation site@0xinhua 发布于 2023年09月19日This article will guide you how to quickly empower your VitePress documentation site with AI conver...
-
3
Create a Delete Modal using HTML and CSS ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK