Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--https://www.niemvuilaptrinh.com/-->
<button class="nut-mo-chatbox" onclick="moForm()">Chat</button>
<div class="Chatbox" id="myForm">
  <form action="" class="form-container">
    <h1>Chatbox</h1>

    <label for="msg"><b>Lời Nhắn</b></label>
    <textarea placeholder="Bạn hãy nhập lời nhắn.." name="msg" required></textarea>

    <button type="submit" class="btn">Gửi</button>
    <button type="button" class="btn nut-dong-chatbox" onclick="dongForm()">Đóng</button>
  </form>
</div>
              
            
!

CSS

              
                {box-sizing: border-box;}

/* Nút Để Mở Chatbox */
.nut-mo-chatbox {
  background-color: #555;
  color: white;
  padding: 16px 20px;
  border: none;
  cursor: pointer;
  opacity: 0.8;
  position: fixed;
  bottom: 23px;
  right: 28px;
  width: 280px;
}

/* Ẩn chatbox mặc định */
.Chatbox {
  display: none;
  position: fixed;
  bottom: 0;
  right: 15px;
  border: 3px solid #f1f1f1;
  z-index: 9;
}

/* Thêm style cho form */
.form-container {
  max-width: 300px;
  padding: 10px;
  background-color: white;
}

/* thiết lập style textarea */
.form-container textarea {
  width: 100%;
  padding: 5px;
  margin: 5px 0 22px 0;
  border: none;
  background: #f1f1f1;
  resize: none;
  min-height: 100px;
}

/*thiết lập style cho textarea khi được focus */
.form-container textarea:focus {
  background-color: #ddd;
  outline: none;
}

/* Sthiết lập style cho nút trong form*/
.form-container .btn {
  background-color: #4CAF50;
  color: white;
  padding: 16px 20px;
  border: none;
  cursor: pointer;
  width: 100%;
  margin-bottom:10px;
  opacity: 0.8;
}

/* Thiết lập màu nền cho nút đóng chatbox */
.form-container .nut-dong-chatbox {
  background-color: red;
}

/* Thêm hiệu ứng hover cho nút*/
.form-container .btn:hover, .nut-mo-chatbox:hover {
  opacity: 1;
}
              
            
!

JS

              
                /*Hàm Mở Form*/
function moForm() {
  document.getElementById("myForm").style.display = "block";
}
/*Hàm Đóng Form*/
function dongForm() {
  document.getElementById("myForm").style.display = "none";
}
              
            
!
999px

Console