Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


Save Automatically?

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


                <div class="wrapper">
  <div id="box"></div>
  <button id="newBook">Add New Book</button>
  <div class="form-container" id="form-contain">
    <h1>Enter Book Details</h1>
      <div class="form-elements">
        <input type="text" placeholder="Enter Name" id="name">
      <div class="form-elements">
        <input type="text" placeholder="Enter Author" id="author">
      <div class="form-elements">
        <input type="text" placeholder="Enter Pages" id="pages">
      <div class="form-elements">
        <label>Read Status:</label>
        <input type="text" placeholder="Read/Not Read" id="read">
      <button class="addItem" id="addItem">Add Item</button>
  <div class="note">
    <p><strong>Note: </strong>To toggle the read status of a book click on the value of the read status cell.</p>


                // Variables
$bg-color: #fff;
$text-color: #797979;

// Components
    background: $bg-color;
    color: $text-color;
    font-size: 20px;
    font-family: 'Nunito';
    text-rendering: optimizeLegibility;

    padding: 10px;
    margin: 0 10px;
    font-size: 1.4em;
    font-weight: 700;

    padding: 10px;
    border: none;
    border-radius: 5px;
    color: #fff;
    font-size: 1.2em;
    font-weight: 500;    

.table {
    width: 90%;
    margin: 10px auto;

thead th {
    background: #27a69d;
    color: #FFF;
    font-weight: bold;

thead th:first-child{
//    border: none;
    border-top-left-radius: 10px;

thead th:last-child{
    border-top-right-radius: 10px;

tr {
    background: #99dfda;

tr:nth-child(odd) {
    background: #67cfc7;

th, td {
    text-align: center;
    padding: 20px;
    font-weight: 400;
    color: #fff;
    border: none;

    background: #fff;
    width: 480px;
    text-align: center;
    margin: 0 auto;
    display: none;

    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    justify-content: space-between;

    display: flex;
    flex-direction: column;
    margin-bottom: 20px;

.form-elements label{
    text-align: left;
    margin: 0;
    font-size: 1em;
    font-weight: 500;

    background: #f8f8fc;
    border: none;
    border-radius: 5px;
    padding: 10px;

    color: #e8e8e8;
    font-weight: 300;

    background: #46b3ab;

    background: #46b3ab;
    margin: 10px 0 0 10px;
    font-size: 1em;

    background: rgba(206, 60, 60, 0.82);
    font-size: 0.58em;
    padding: 5px;
    letter-spacing: 1.2px;
    border-radius: 2px;

    margin: 10px;

.note p{
    font-size: 0.8em;


                // Variables
const box = document.getElementById("box");
const newBook = document.getElementById("newBook");
const formContain = document.getElementById("form-contain");
const name = document.getElementById("name");
const author = document.getElementById("author");
const page = document.getElementById("pages");
const read = document.getElementById("read");
const addItemBtn = document.getElementById("addItem");

const myLib = [];

// Object Constructor
function Book(name, author, page, status){
    this.Name = name;
    this.Author = author;
    this.Pages = page;
    this.Read = status;

function attachRemoveBtn(tableData5){
    let deleteBtn = create('button');
    deleteBtn.className = 'delete';
    deleteBtn.textContent = 'Remove';

// table data function 
function create(data){
    return document.createElement(data);

function attach(first_param, second_param){
  return first_param.appendChild(second_param);

// Table Creation
let table = create('table');
table.className = 'table'; // Bootstrap's table class
let tableHead = create("thead");
let tableHeading1 = create("th");
let tableHeading2 = create("th");
let tableHeading3 = create("th");
let tableHeading4 = create("th");
let tableHeading5 = create('th');

tableHeading1.textContent = "Name";
tableHeading2.textContent = "Author";
tableHeading3.textContent = "Pages";
tableHeading4.textContent = "Read Status";
tableHeading5.textContent = "Remove";

attach(tableHead, tableHeading1);
attach(tableHead, tableHeading2);
attach(tableHead, tableHeading3);
attach(tableHead, tableHeading4);
attach(tableHead, tableHeading5);
attach(table, tableHead);

// Adding event to button
addItemBtn.addEventListener('click', (event) => {    
    // Calling of Constructor
    const lib = new Book(name.value, author.value, page.value, read.value);
    let tableRow = create('tr');

    let tableData1 = create('td');
    let tableData2 = create('td');
    let tableData3 = create('td');
    let tableData4 = create('td');
    tableData4.className = 'read';
    let tableData5 = create('td');

    tableData1.textContent = lib.Name;
    tableData2.textContent = lib.Author;
    tableData3.textContent = lib.Pages;
    tableData4.textContent = lib.Read;

    table.appendChild(tableRow);         = "none"; = "block";  
    name.value = ' ';
    author.value = ' ';
    page.value = ' ';
    read.value = ' ';
    attach(box, table);

// Show hide the form and button
newBook.addEventListener('click', () => {
   if( = "none"){ = "block"; = "none";

table.addEventListener('click', (event) => {
    // Remove a book
    if( === 'BUTTON'){
        if( === 'delete'){
            let parDel =; // Returns delete parent
            let table = parDel.parentNode; //Returns table
    // Change Book Read Status
    if( === 'read' ){
        if( === 'READ'){
   = 'Not Read';
        }else if( === 'NOT READ' ){
   = 'Read';