Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>todo app</title>
    <link rel="stylesheet" href="css/style.css">
    <script src="https://kit.fontawesome.com/3d64925a9f.js" crossorigin="anonymous"></script>
</head>
<body>
    <div class="todo__container">
        <div class="todo__container__top">
            <div class="todo__container__title">
                <h1 class="title">Todo List</h1>
            </div>
            <div class="todo__container__input">
                <label for="input">
                    <input id="input" type="text" placeholder="Press Enter to Add Item">
                </label>
            </div>
        </div>
        <hr>
        <div class="todo__container__content">
            <h2 class="title">Your Tasks</h2>
            <ul>
                <div id="item">
                    <li class=""> <input type="checkbox"> Washing</li>
                </div>
                <div id="item">
                    <li class=""> <input type="checkbox"> Study</li>
                </div>
                <div id="item">
                    <li class=""> <input type="checkbox"> Shopping</li>
                </div>
            </ul>
        </div>
    </div>
    <script src="js/app.js"></script>
</body>
</html>
              
            
!

CSS

              
                *, *::before, *::after {
    padding: 0;
    margin: 0;
    box-sizing: inherit;
}

html {
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #002642;
}

.todo__container {
    height: 500px;
    width: 500px;
    background: #840032;
    padding: 10px;
    overflow: auto;
    border: 4px solid white;
}


.title {
    /* color: #EED5C2; */
    color: #E59500;
}

.icon {
    /* color: #EED5C2; */
    color: #E5DADA;
}

.todo__container__top {
    /* border: 2px solid #fff; */
    padding: 20px;
}

.todo__container__title {
    text-align: center;
    font-size: .8rem;
}

.todo__container__input {
    width: 100%;
    /* border: 2px solid #fff; */
    margin: 20px 0;
}


.todo__container__input input{
    all: unset;
    border: 2px solid rgba(0, 0, 0, 0);
    border-radius: 7.5px;
    padding: 7px;
    width: 70%;
    background: #E5DADA;
    color: #000;
    font-weight: 600;
    display: block;
    margin: 0 auto;
    /* transition: all .5s ease; */
}

.todo__container__input input:focus{
    border: 2px solid #000;
}


.todo__container__input input:hover{
    cursor: text;
}

hr {
    border: 2px solid #fff;
}

.todo__container__content {
    /* border: 2px solid red; */
    padding: 10px;
    color: #EED5C2;
    margin: 10px;
    padding: 20px;
}

.todo__container__content ul {
    list-style-type: none;
    display: flex;
    flex-direction: column;
}

.todo__container__content h2 {
    font-size: 1.75rem;
    margin-bottom: 30px;
    text-align: center;
}

.todo__container__content ul li {
    margin: 10px;
    font-size: 1.2rem;
}

.checked {
    text-decoration: line-through;
    color: #E59500;
}

.todo__container__content input {
    margin-right: 7.5px;
  -webkit-appearance: none;
	background-color: transparent;
	border: 2px solid #fff;
	padding: 9px;
    border-radius: 3px;
    position: relative;
    top: 4px;
    outline: none;
}

.todo__container__content input:hover {
  cursor: pointer;
}

.todo__container__content input:checked:before {
	content: '\2714';
    font-size: 16px;
    font-weight: 600;
	position: absolute;
	top: -2px;
	left: 3px;
    color: #E59500;
}

#item {
    /* border: 2px solid #fff; */
    background: blue;
    margin-bottom: 5px;
    cursor: pointer;
}
              
            
!

JS

              
                const listItem = document.querySelectorAll('#item')


function taskLineThrough() {

    for (let i = 0; i < listItem.length; i++) {

        listItem[i].addEventListener('click', function () {
            listItem[i].classList.toggle('checked')
            if (listItem[i].firstElementChild.firstElementChild.checked) {
                listItem[i].firstElementChild.firstElementChild.checked = false;
            } else {
                listItem[i].firstElementChild.firstElementChild.checked = true;
            }
    })

}
}

taskLineThrough();

              
            
!
999px

Console