Chatbot Bliss - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>ChatBot Bliss</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> <style> body { font-family: 'Arial', sans-serif; background-color: #e0f7fa; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .chatbot-container { background: #fff; width: 400px; max-width: 100%; border-radius: 15px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); overflow: hidden; } .chatbot-header { background: #00bcd4; padding: 15px; color: #fff; display: flex; align-items: center; justify-content: space-between; } .chatbot-header h2 { margin: 0; font-size: 18px; } .chatbot-header .icons i { margin-left: 10px; cursor: pointer; transition: color 0.3s; } .chatbot-header .icons i:hover { color: #ffeb3b; } .chatbot-body { padding: 20px; height: 300px; overflow-y: auto; background: #b2ebf2; display: flex; flex-direction: column; gap: 10px; } .chatbot-message { max-width: 80%; padding: 10px; border-radius: 10px; display: flex; align-items: center; gap: 10px; } .chatbot-message.bot { background: #00bcd4; color: #fff; align-self: flex-start; } .chatbot-message.user { background: #d1d8e0; align-self: flex-end; } .chatbot-message img { width: 30px; height: 30px; border-radius: 50%; } .chatbot-footer { display: flex; border-top: 1px solid #ddd; padding: 15px; } .chatbot-footer input { flex: 1; padding: 10px; border: none; border-radius: 5px; margin-right: 10px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); } .chatbot-footer button { background: #00bcd4; color: #fff; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; transition: background 0.3s; } .chatbot-footer button:hover { background: #008ba3; } @keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } } .chatbot-footer button i { animation: bounce 1s infinite; } </style> </head> <body> <div class="chatbot-container"> <div class="chatbot-header"> <h2>ChatBot Bliss <i class="fas fa-robot"></i></h2> <div class="icons"> <i class="fas fa-cog"></i> <i class="fas fa-question-circle"></i> </div> </div> <div class="chatbot-body" id="chatbotBody"> <!-- Messages will appear here --> </div> <div class="chatbot-footer"> <input type="text" id="userInput" placeholder="Type a message..."> <button type="button" id="sendBtn" title="Send"><i class="fas fa-paper-plane"></i></button> </div> </div> <script> document.getElementById('sendBtn').addEventListener('click', sendMessage); document.getElementById('userInput').addEventListener('keypress', function (e) { if (e.key === 'Enter') { sendMessage(); } }); function sendMessage() { const userInput = document.getElementById('userInput'); const message = userInput.value.trim(); if (message) { appendMessage('user', message); userInput.value = ''; setTimeout(() => appendMessage('bot', 'I am a chatbot, how can I help you?'), 1000); } } function appendMessage(sender, message) { const chatbotBody = document.getElementById('chatbotBody'); const messageElem = document.createElement('div'); messageElem.classList.add('chatbot-message', sender); messageElem.innerHTML = `<img src="https://via.placeholder.com/30" alt="User"><span>${message}</span>`; chatbotBody.appendChild(messageElem); chatbotBody.scrollTop = chatbotBody.scrollHeight; } </script> </body> </html>