chat box html

Solutions on MaxInterview for chat box html by the best coders in the world

showing results for - "chat box html"
Alice
15 May 2018
1<!DOCTYPE html>
2<html>
3<head>
4<meta name="viewport" content="width=device-width, initial-scale=1">
5<style>
6body {font-family: Arial, Helvetica, sans-serif;}
7* {box-sizing: border-box;}
8
9/* Button used to open the chat form - fixed at the bottom of the page */
10.open-button {
11  background-color: cyan;
12  color: white;
13  padding: 16px 20px;
14  border: none;
15  cursor: pointer;
16  opacity: 0.8;
17  position: fixed;
18  bottom: 23px;
19  right: 28px;
20  width: 280px;
21}
22
23/* The popup chat - hidden by default */
24.chat-popup {
25  display: none;
26  position: fixed;
27  bottom: 0;
28  right: 15px;
29  border: 3px solid #f1f1f1;
30  z-index: 9;
31}
32
33/* Add styles to the form container */
34.form-container {
35  max-width: 300px;
36  padding: 10px;
37  background-color: white;
38}
39
40/* Full-width textarea */
41.form-container textarea {
42  width: 100%;
43  padding: 15px;
44  margin: 5px 0 22px 0;
45  border: none;
46  background: #f1f1f1;
47  resize: none;
48  min-height: 200px;
49}
50
51/* When the textarea gets focus, do something */
52.form-container textarea:focus {
53  background-color: #ddd;
54  outline: none;
55}
56
57/* Set a style for the submit/send button */
58.form-container .btn {
59  background-color: #04AA6D;
60  color: white;
61  padding: 16px 20px;
62  border: none;
63  cursor: pointer;
64  width: 100%;
65  margin-bottom:10px;
66  opacity: 0.8;
67}
68
69/* Add a red background color to the cancel button */
70.form-container .cancel {
71  background-color: red;
72}
73
74/* Add some hover effects to buttons */
75.form-container .btn:hover, .open-button:hover {
76  opacity: 1;
77}
78</style>
79</head>
80<body>
81
82<h1>Ychat</h1>
83<p>Made by Yasin</p>
84
85<button class="open-button" onclick="openForm()">Chat</button>
86
87<div class="chat-popup" id="myForm">
88  <form action="/action_page.php" class="form-container">
89    <h1>Chat</h1>
90
91    <label for="msg"><b>Message</b></label>
92    <textarea placeholder="Type message.." name="msg" required></textarea>
93
94    <button type="submit" class="btn">Send</button>
95    <button type="button" class="btn cancel" onclick="closeForm()">Close</button>
96  </form>
97</div>
98
99<script>
100function openForm() {
101  document.getElementById("myForm").style.display = "block";
102}
103
104function closeForm() {
105  document.getElementById("myForm").style.display = "none";
106}
107</script>
108
109</body>
110</html>
111