<button class="chat-toggle" id="chatToggle" aria-label="Open Chat">
<span class="icon-open">💬</span>
<span class="icon-close">×</span>
</button>
<div class="chat-widget" id="chatWidget">
<div class="chat-header">
<div class="agent">
<img src="https://placehold.co/40x40/3b82f6/ffffff?text=A" alt="Agent">
<div>
<h4>Support Team</h4>
<span>Online</span>
</div>
</div>
</div>
<div class="chat-body">
<div class="msg income">Hi! How can we help you?</div>
</div>
<div class="chat-footer">
<input type="text" placeholder="Type a message...">
<button>➤</button>
</div>
</div>.chat-toggle {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
position: fixed;
bottom: 30px;
right: 30px;
width: 60px;
height: 60px;
background: #2563eb;
color: white;
border: none;
border-radius: 50%;
box-shadow: 0 5px 20px rgba(37, 99, 235, 0.4);
cursor: pointer;
z-index: 1000;
font-size: 1.5rem;
transition: transform 0.3s;
display: flex;
align-items: center;
justify-content: center;
}
.chat-toggle:hover {
transform: scale(1.1);
}
.icon-close { display: none; }
.chat-toggle.open .icon-open { display: none; }
.chat-toggle.open .icon-close { display: block; font-size: 2rem; }
.chat-widget {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
position: fixed;
bottom: 100px;
right: 30px;
width: 350px;
background: #fff;
border-radius: 16px;
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
z-index: 999;
overflow: hidden;
transform: translateY(20px);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.chat-widget.active {
transform: translateY(0);
opacity: 1;
visibility: visible;
}
.chat-header {
background: #2563eb;
padding: 20px;
color: white;
}
.agent {
display: flex;
align-items: center;
gap: 10px;
}
.agent img { border-radius: 50%; border: 2px solid white; }
.agent h4 { margin: 0; font-size: 1rem; }
.agent span { font-size: 0.8rem; opacity: 0.9; }
.chat-body {
padding: 20px;
height: 250px;
background: #f9fafb;
overflow-y: auto;
}
.msg {
max-width: 80%;
padding: 10px 15px;
border-radius: 12px;
margin-bottom: 10px;
font-size: 0.9rem;
}
.income {
background: #e5e7eb;
color: #1f2937;
border-bottom-left-radius: 2px;
}
.chat-footer {
padding: 15px;
border-top: 1px solid #e5e7eb;
display: flex;
gap: 10px;
}
.chat-footer input {
flex: 1;
padding: 10px;
border: 1px solid #d1d5db;
border-radius: 20px;
outline: none;
}
.chat-footer button {
background: #2563eb;
color: white;
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
cursor: pointer;
}const toggle = document.getElementById("chatToggle");
const widget = document.getElementById("chatWidget");
toggle.addEventListener("click", () => {
toggle.classList.toggle("open");
widget.classList.toggle("active");
});Nothing to show yetType HTML, CSS or JavaScript and your page appears here.
Click any element to find its code Esc
Check this code before you run it
It came from a shared link. It runs with fewer permissions, so it cannot open pop-ups, submit forms or start downloads.
0.00s / 0.00s
Nothing has animated yet. Hover, click or type in the preview and each CSS animation, transition or
element.animate() call shows up here as it plays.