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

              
                <body>
    <form action="#" class="form">
        <div>
            <label> Логин:
                <input type="text" required>
            </label>
        </div>
        <div>
            <input type="text" id="first_name">
            <label for="first_name"> ФИО:</label>
        </div>
        <div>
            <label for="password"> Введите пароль:</label>
            <input type="password" required id="password">
        </div>
        <div>
            <a href="#" class="recovery">Забыли пароль</a>
        </div>
        <div>
            <label> Выберите город:
                <select>
                    <option value="Киев">Киев</option>
                    <option value="Мариуполь" selected>Мариуполь</option>
                    <option value="Донецк">Донецк</option>
                    <option value="Берлин">Берлин</option>
                    <option value="Москва">Москва</option>
                    <option value="Вашингтон">Вашингтон</option>
                </select>
            </label>
        </div>
        <div>
            <label> Дата рождения:
                <input type="date">
            </label>
        </div>
        <div> Выберите язык:
            <div>
                <label for="eng">English</label>
                <input type="checkbox" id="eng">
            </div>
            <div>
                <label for="rus">Русский</label>
                <input type="checkbox" id="rus">
            </div>
            <div>
                <label for="ukr">Український</label>
                <input type="checkbox" id="ukr">
            </div>
        </div>
        <div>Выберите пол
            <div>
                <label for="man">Муж.</label>
                <input type="radio" id="man" name="sex">
            </div>
            <div>
                <label for="woman">Жен. </label>
                <input type="radio" id="woman" name="sex">
            </div>
        </div>
        <div>
            <label> О себе: </label>
            <textarea placeholder="Напишите что-то про себя"></textarea>
        </div>
        <div>
            <input type="submit" value="Отправить форму" class="btn">
        </div>

    </form>

</body>

              
            
!

CSS

              
                * {
    box-sizing: border-box;
}

.form {
    width: 500px;
    border: 1px solid grey;
    margin: 0 auto;
    text-transform: uppercase;
    background-color: #404040;
    color: #dfdbdf;
    text-shadow: 1px 1px 3px black;
}

form div {
    width: 400px;
    margin: 20px auto;
}

form div input,
select {
    float: right;
    width: 200px;
    background-color: rgba(0, 0, 0, 0.16);
    color: #999898;
    border: none;
}

label {
    text-align: right;
    text-transform: none;
}

input[type="checkbox"] {
    height: 15px;
}

input[type="radio"] {
    height: 15px;
}

.recovery {
    color: #00a1d2;
    text-decoration: none;
    font-size: 14px;
    text-transform: none;
    padding-left: 200px;
    letter-spacing: 1px;
    position: relative;
    bottom: 15px;
}

textarea {
    resize: none;
    width: 330px;
    height: 100px;
    margin-left: 70px;
    margin-top: -15px;
}

.btn {
    background-color: rgb(149, 204, 149);
    color: black;
    font-size: 18px;
}
              
            
!

JS

              
                // Есть множество div элементов с одинаковым классом.При переборе я должен найти тот div в блоке которого указано например буква 'h'
// и присвоить ему новый класс.

let inp = document.querySelector("#inp");
let but = document.querySelectorAll('.buttoN');
inp.onkeydown = function(e) {
  for(var i = 0; i < but.length; i++) {
    if (but[i].textContent == e.key){
      but[i].classList.toggle("red");}
  }
}
              
            
!
999px

Console