Forms are an important interactive web page element. Like links, forms provide interaction between the user and the page, allowing data to be sent. There are special constructs in HTML for this that tell the browser which fields the user can use and how to handle them.
The forms are a far too big topic to cover in one lesson because all the possible nuances could make forms a course in and of themselves. Fear not – you'll learn here enough to be able to make good forms.
Creating a form
A special tag, <form>, is used to separate the form from the rest of the layout. If you don't use it, the browser will not understand what data to send. After all, there can be several forms on a page.
The server is a remote computer where the entire project is stored. You're now looking at a page that was generated on the server and given to you at a certain address. This address is currently listed in your browser.
An example of interacting with a form is using a search engine, Google or Bing. You enter a search query, which is sent to the server. The server processes the results and gives you suitable sites. This interaction takes place using server-side programming languages such as PHP, Ruby, etc. When it comes to layout, we have no control over how the result is handled. The result is a set of tags used by the browser to collect data and send it to the server.
The <form> tag can take several different attributes. They're not required, but they can have a significant effect on your work. The most important of these is the action attribute. It allows you to specify the directory or file on the server where the data will be sent. If this attribute is not specified, the data will be sent to the same page where the form is located.
You'll understand the meaning of this action better if you're involved in backend development, for example, in PHP or Python. If you find it difficult right now, don't despair. The developers will always tell you where to send the data.
Form fields
The <form> tag alone is not enough to create a complete form because the user needs to enter some data. The easiest way is to give a text field where the user can enter information. HTML uses two tags for this:
- <input> - a single tag that contains a small amount of information. This can be a phone number, email, date of birth, name, etc
- <textarea> is a paired tag that allows the user to write more text. It can be a comment for an order or a review
textarea
The simplest tag is <textarea>. Its job is to create a large text box.
In the example, you can see the two attributes of the <textarea> tag: cols and rows. They are responsible for the number of characters and strings that are available inside textarea. If there's more content, then there'll be a scroll bar.
Try resizing the <textarea> element. This can be done by pulling the bottom-right corner. You can do this not only to increase the width but also the height, too.
This behavior is often detrimental to our design. That's why developers don't allow it in most cases. There are several options here:
- You can set the height and width of the element using CSS. Then the browser won't let the element be stretched
- Use the resize property with the value set to none. Use it if your website doesn't support mobile browsers or Internet Explorer. For a complete list of supported browsers, visit the Can I Use website
input
A large group of fields can be created using the <input> tag, the main attribute of which is type. It specifies exactly how the browser should handle the element. It makes no sense to look at each value individually because so much information will quickly be forgotten if it is not used.
In this lesson, we'll look at some of the most popular values for the type attribute.
type="text"
The simplest kind is input, which allows you to enter any information from the user. This field doesn't have built-in validation, the only exception is removing line breaks before sending data to the server. If you want data with line breaks, use the <textarea> tag.
Note that now the field is not marked in any way, making it totally unclear what the user needs to enter. The first thing that comes to mind is to add a heading or a paragraph before the field. Yes, this will give the appearance of a field description. But appearance is only one thing! In terms of semantics, there is no connection between the text and the input field. This is critical for users who use screen readers, as they might not realize that the field name and the field itself are connected.
A screen reader is a device for reading text from a screen. Used by people who are blind or visually impaired.
To link the field and its name, we use the <label> tag and put text inside it. To link <label> and <input>, we can use one of two options. They're interchangeable, so you can use the one that's convenient for your particular situation.
- Link by identifier. For this purpose, the <input> tag is given a unique id. The <label> is given the attribute for, whose value is the input's id
- Embedding <input> inside <label>. This method means you don't have to give ids, but it can make the styling process a little more complicated
Important: All elements that users can fill out must have a <label> tag. These are the <input> and <textarea> elements. This is true even if there is no visual caption for the field.
You can use the following CSS code to hide the element. As you grow as a developer, you'll get to understand all the rules described in this code. Usually, the used to hide an element is called .sr-only. This element will be invisible to the user, but the screen reader can read it.
type="radio"
Radio buttons are used to select one option from multiple available ones. Why radio? There is a belief that this type got its name from the first car radios. There were several radio stations available, but only one could be chosen at a time. The meaning here is very similar to that of radio receivers.
In addition to the attributes used in the previous examples, there is another important attribute for radio buttons - name. It's unique to the group of radio buttons.
In addition to the name attribute, radio buttons also use the value attribute. Inside it is the value that will be sent to the server.
type="checkbox"
Checkboxes are a bit like radio buttons, but have a significant difference - you can select several values at once. Imagine the user is choosing their favorite dishes. It's probably more than one dish. They could use <textarea>, but checkboxes are preferable.
Lists
Lists are separate elements in forms. Imagine a filter on a tech store website. You can only filter items in one category at a time. You can use radio buttons for this, or even checkboxes in the case of multiple choices. But there is another way, you can use a list.
Creating a list is very similar to creating a piece of text that's a list. We use the <select> select tags for this in forms, and its items are found inside <option> tags.
In the example, there is a new attribute - selected. It's responsible for which item is selected by default. If it's not specified, the first item in the list will be selected.
For radio button and checkbox elements, the checked attribute is used by default.
There's another interesting attribute is available for lists, multiple. With it, the list becomes similar to checkboxes and allows you to select several items.
Submittig the form
In the last section, we looked at the different ways in which the user and the form can interact. But it doesn't make any sense if the form won't be sent. To do this, you need to create an element that will send a form when interacted with.
The form can be sent in one of two ways:
- Create an <input> with type submit. In this case, an element will be created in the form of a button with the name specified as the value of the value attribute
- Using a paired <button> tag. This method gives your more opportunities because the button can contain any HTML code, which, when clicked, will send the form. This method is very convenient for creating a button that's an icon. Right now, this method is the most popular
Separating form sections
Forms that aren't separated into sections are a nightmare for users. Once you get to the middle of the form, you'll have no idea which fields are filled with what. You can separate sections with headers or visually. But browsers provide a special mechanism for dividing sections of the form into logical sections - fieldset. They can be seen as an alternative to the <section> tag, but only for forms. The <legend> tag is used as the header.
Text inside a text box
In all the examples in this lesson, the text fields were originally blank. You've probably often seen that there is text in the field before you click on it, inviting you to enter data or showing the format of the expected input.
The placeholder attribute, whose value is the text that is displayed before you click on it (actually, before focus event).
Important: placeholder is not a replacement for the <label> tag. Think of placeholder as the description of a text field, and <label> as the name of that field.
<!DOCTYPE html>
<html class="h-100" data-bs-theme="light" data-mantine-color-scheme="light" lang="en" prefix="og: https://ogp.me/ns#">
<head>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<link crossorigin="true" href="https://cdn.hexlet.io" rel="preconnect">
<meta content="aa2vrdtq64dub8knuf83lwywit311w" name="facebook-domain-verification">
<link href="/favicon.ico" rel="icon" sizes="any">
<link href="/favicon.svg" rel="icon" type="image/svg+xml">
<link href="/apple-touch-icon.png" rel="apple-touch-icon">
<link href="/manifest.webmanifest" rel="manifest">
<script>
//<![CDATA[
window.gon={};gon.ym_counter="25559621";gon.is_bot=true;gon.applications={};gon.current_user={"id":null,"last_viewed_notification_id":null,"email":null,"state":null,"first_name":"","last_name":"","current_program":null,"current_team":null,"full_name":"","guest":true,"can_use_paid_features":false,"is_hexlet_employee":false,"sanitized_phone_number":"","can_subscribe":true,"can_renew_education":false};gon.token="4nKrrkMi8I6xOGYQm15Omgd2DbtpLphfRpdXeaO4CtCxtMaYYknLbtYymfgpwHlbC9yD4KUwglPkEp1q7mTVCw";gon.locale="en";gon.language="en";gon.theme="light";gon.rails_env="production";gon.mobile=false;gon.google={"analytics_key":"UA-1360700-51","optimize_key":"GTM-5QDVFPF"};gon.captcha={"google_v3_site_key":"6LenGbgZAAAAAM7HbrDbn5JlizCSzPcS767c9vaY","yandex_site_key":"ysc1_Vyob5ZPPUdPBsu0ykt8bVFdzsfpoVjQChLGl2b4g19647a89","verification_failed":null};gon.social_signin=false;gon.typoreporter_google_form_id="1FAIpQLScNwxM8rjQRRWqW5G6dn6-0NvLUblFemy7EvA9VsJ7Ov5wXqA";
//]]>
</script>
<meta charset="utf-8">
<title>Forms | Content layout fundamentals</title>
<meta name="description" content="Forms / Content layout fundamentals: Learn to create the cornerstone website element: form. Explore the standard elements of data input and form submission">
<link rel="canonical" href="https://hexlet.io/courses/css-content/lessons/forms/theory_unit">
<meta name="robots" content="noarchive">
<meta property="og:title" content="Forms">
<meta property="og:title" content="Content layout fundamentals">
<meta property="og:description" content="Forms / Content layout fundamentals: Learn to create the cornerstone website element: form. Explore the standard elements of data input and form submission">
<meta property="og:url" content="https://hexlet.io/courses/css-content/lessons/forms/theory_unit">
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="UktmvV-JiwNIJYfo5f9zrO211o4Rffmckiyir-jzEgYBjQuLfuKw4y8veABXYURt4R9Y1d1j45AwqWi8pS_N3Q" />
<script src="/vite/assets/inertia-CgrHVkgd.js" crossorigin="anonymous" type="module"></script><link rel="modulepreload" href="/vite/assets/chunk-DsPFFUou.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/preload-helper-C1cfMHAs.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/init-0bhwJkNI.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/ahoy-BXKrsWjp.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/analytics-Du9ljYPK.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/ErrorFallbackBlock-V3hfk_CP.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/RootLayout-CUZzAr0T.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/Surface-DbDKujDz.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/gon-B-jV56Ol.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/mantine-DOJkeu70.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/utils-ClTF9s_T.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/routes-mvvEXZQ8.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/index.esm-DATLpQdV.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/Modal-BhY0AP_c.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/Textarea-P1s4q94S.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/exports-BsSGGK2I.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/dayjs.min-Bfba02I7.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/client-CYyKzrjQ.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/react-dom-SJZekO2j.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/useTranslation-bo78L81P.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/compiler-runtime-BhqaZ6vG.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/jsx-runtime-DlXMvSuQ.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/react-CFtMU8gd.js" as="script" crossorigin="anonymous">
<link rel="stylesheet" href="/vite/assets/application-BhDYOUva.css" />
<script src="/vite/assets/application-ZyVHkzwO.js" crossorigin="anonymous" type="module"></script><link rel="modulepreload" href="/vite/assets/chunk-DsPFFUou.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/autocomplete-BokUl44d.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/routes-mvvEXZQ8.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/createPopper-gQnwoPhY.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/js.cookie-CB1F2-VC.js" as="script" crossorigin="anonymous"><link rel="stylesheet" href="/vite/assets/application-BhDYOUva.css" media="screen" />
<!-- Google Tag Manager - deferred -->
<script>
// dataLayer stub сразу — пуши работают до загрузки скрипта
window.dataLayer = window.dataLayer || [];
// Сам скрипт — отложенно после load
window.addEventListener('load', function() {
setTimeout(function() {
dataLayer.push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
var j = document.createElement('script');
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=GTM-WK88TH';
document.head.appendChild(j);
}, 1500);
});
</script>
<!-- End Google Tag Manager -->
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe height="0" src="https://www.googletagmanager.com/ns.html?id=GTM-WK88TH" style="display:none;visibility:hidden" width="0"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->
<header class="sticky-top bg-body">
<nav class="navbar navbar-expand-lg">
<div class="container-xxl">
<a class="navbar-brand" href="/"><img alt="Hexlet logo" height="24" src="https://hexlet.io/vite/assets/logo_en_light-FS-yL6XB.svg" width="96">
</a><button aria-controls="collapsable" aria-expanded="false" aria-label="Menu" class="navbar-toggler border-0 mb-0 mt-1" data-bs-target="#collapsable" data-bs-toggle="collapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsable">
<ul class="navbar-nav mb-lg-0 mt-lg-1">
<li class="nav-item dropdown">
<button aria-haspopup class="btn nav-link" data-bs-toggle="dropdown" type="button">
All courses
<span class="bi bi-chevron-down align-middle ms-1"></span>
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item d-flex py-2" href="/courses"><div class="fw-bold me-auto">Everything</div>
<div class="text-muted">8</div>
</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li class="dropdown-item">
<b>Popular categories</b>
</li>
<li>
<a class="dropdown-item py-2" href="/courses_backend-development">Backend Development
</a></li>
<li>
<a class="dropdown-item py-2" href="/courses_devops">DevOps
</a></li>
<li>
<a class="dropdown-item py-2" href="/courses_frontend-development">Frontend Development
</a></li>
<li>
<a class="dropdown-item py-2" href="/courses_testing">Testing
</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li class="dropdown-item">
<b>Popular courses</b>
</li>
<li>
<a class="dropdown-item py-2" href="/programs/frontend">Frontend Developer
</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<button aria-haspopup class="btn nav-link" data-bs-toggle="dropdown" type="button">
About Hexlet
<span class="bi bi-chevron-down align-middle"></span>
</button>
<ul class="dropdown-menu bg-body">
<li>
<a class="dropdown-item py-2" href="/pages/about">About company
</a></li>
<li>
<a class="dropdown-item py-2" href="/blog">Blog
</a></li>
<li>
<span class="dropdown-item py-2 external-link" data-href="https://special.hexlet.io/hse-research" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.results">Results</span>
</span></li>
<li>
<span class="dropdown-item py-2 external-link" data-href="https://career.hexlet.io" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.career">Career</span>
</span></li>
<li>
<a class="dropdown-item py-2" href="/testimonials">Testimonials
</a></li>
<li>
<span class="dropdown-item py-2 external-link" data-href="https://t.me/hexlet_help_bot" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.support">Support</span>
</span></li>
<li>
<span class="dropdown-item py-2 external-link" data-href="https://special.hexlet.io/referal-program/?promo_creative=priglasite-druzei&promo_name=referal-program&promo_position=promo_position&promo_start=010724&promo_type=link" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.referal_program">Referal Program</span>
</span></li>
<li>
<span class="dropdown-item py-2 external-link" data-href="https://special.hexlet.io/certificate" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.certificates">Certificates</span>
</span></li>
<li>
<span class="dropdown-item py-2 external-link" data-href="https://hh.ru/employer/4307094" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.vacancies">Vacancies</span>
</span></li>
<li>
<span class="dropdown-item d-flex external-link" rel="noopener noreferrer nofollow" data-href="https://b2b.hexlet.io" data-target="_blank" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.teams">Teams</span>
</span></li>
<li>
<span class="dropdown-item d-flex external-link" rel="noopener noreferrer nofollow" data-href="https://hexly.ru/" data-target="_blank" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.college">College</span>
</span></li>
<li>
<span class="dropdown-item d-flex external-link" rel="noopener noreferrer nofollow" data-href="https://hexlyschool.ru/" data-target="_blank" role="button"><span class="translation_missing" title="translation missing: en.layouts.header.private_school">Private School</span>
</span></li>
</ul>
</li>
</ul>
<ul class="navbar-nav flex-lg-row align-items-lg-center gap-2 ms-auto">
<li>
<a class="nav-link" aria-label="Switch theme" href="/theme/switch?new_theme=dark"><span aria-hidden="true" class="bi bi-moon"></span>
</a></li>
<li>
<span data-target="_self" class="nav-link external-link" data-href="/u/new" role="button"><span>Sign up</span>
</span></li>
<li>
<span data-target="_self" class="nav-link external-link" data-href="https://hexlet.io/session/new" role="button"><span>Sign in</span>
</span></li>
</ul>
</div>
</div>
</nav>
</header>
<div class="x-container-xxxl">
</div>
<main class="mb-6 min-vh-100 h-100">
<link rel="preload" as="image" href="https://hexlet.io/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MTIzNTMsInB1ciI6ImJsb2JfaWQifX0=--f1948fb0c5a45a6d76671a1a32b8cf6f0b53ee57/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbNDAwLDQwMF0sInNhdmVyIjp7InF1YWxpdHkiOjg1fX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--5b6f46dacd1af664f27558553a58076185091823/Software%20code%20testing-cuate.png"/><link rel="preload" as="image" href="/vite/assets/development-BVihs_d5.png"/><div id="app" data-page="{"component":"web/courses/lessons/theory_unit","props":{"errors":{},"locale":"en","language":"en","httpsHost":"https://hexlet.io","host":"hexlet.io","colorScheme":"light","auth":{"user":{"id":null,"last_viewed_notification_id":null,"email":null,"state":null,"first_name":"","last_name":"","current_program":null,"current_team":null,"full_name":"","guest":true,"can_use_paid_features":false,"is_hexlet_employee":false,"sanitized_phone_number":"","can_subscribe":true,"can_renew_education":false}},"cloudflareTurnstileSiteKey":"0x4AAAAAAA15KmeFXzd2H0Xo","vkIdClientId":"51586979","yandexIdClientId":null,"formAuthToken":"DeMMkAysBkN12PcGypsnj3wLFyEccNLaLvNv485kprBeJWGmLcc9oxLSCO54BRBOcKGZetBuyNaMdqXwg7h5aw","topics":[],"lesson":{"exercise":{"id":1760,"slug":"css_content_forms_exercise","name":null,"state":"active","kind":"exercise","language":"html","locale":"en","has_web_view":true,"has_test_view":false,"reviewable":true,"readme":"Make a feedback form using the following layout. There are five main elements in the form:\n\n* Two text inputs for name and email\n* Message box\n* Checkbox to accept the terms of service\n* Button to send a message\n\n\n\n## index.html\n\n* First-level form heading: \"Feedback\"\n* Each text field is wrapped in a container with a class `.form-input`. A bottom margin of each field is set using `.mb-2` class. Each text field must have a label, which is hidden using the class `.sr-only`. This class is already defined in _app.css_\n* The checkbox is wrapped in a container with classes `.small` and `.mb-1`\n\n---\n\n**Wrapper (container)** is a block that encapsulates some elements. `<div>` or `<section>` elements are usually used as wrappers . For instance,\n\n```html\n<div class=\"container\">\n <p>Paragraph 1</p>\n <p>Paragraph 2</p>\n <p>Paragraph 3</p>\n <p>Paragraph 4</p>\n</div>\n```\n\n`div` with a `.container` class is a wrapper for paragraphs.\n\n---\n\n### Fields' description\n\n* Name\n* Email\n* Message\n* I accept the terms of service\n\n## app.css\n\nAdd styles for _form-input_ following guidelines.\n\n* All child elements of the `form-input` class must be rendered as block-level elements and have a width of 100%\n* Text fields are 50 pixels high with 10 pixels vertical paddings and 20 pixels horizontal paddings. To preserve the size, change the behavior of the block model using the `box-sizing` property with a `border-box` value. Fields have a solid border of 1 pixel and the color `#e2e2e2`\n* The message field is 200 pixels high. Forbid the user from adjusting its size\n\n## Tips\n\nYou can select all child elements using `*`. For instance, here\n\n```css\n.block * {\n color: white;\n}\n```\n\nwe set white color for each child element of `.block`.\n\nYou can also use it with other combinators like `>`, then, the following selector\n\n```css\n.block > * {\n color: white;\n}\n```\n\nallows us to set white color for `.block` _immediate children_.\n","prepared_readme":"Make a feedback form using the following layout. There are five main elements in the form:\n\n* Two text inputs for name and email\n* Message box\n* Checkbox to accept the terms of service\n* Button to send a message\n\n\n\n## index.html\n\n* First-level form heading: \"Feedback\"\n* Each text field is wrapped in a container with a class `.form-input`. A bottom margin of each field is set using `.mb-2` class. Each text field must have a label, which is hidden using the class `.sr-only`. This class is already defined in _app.css_\n* The checkbox is wrapped in a container with classes `.small` and `.mb-1`\n\n---\n\n**Wrapper (container)** is a block that encapsulates some elements. `<div>` or `<section>` elements are usually used as wrappers . For instance,\n\n```html\n<div class=\"container\">\n <p>Paragraph 1</p>\n <p>Paragraph 2</p>\n <p>Paragraph 3</p>\n <p>Paragraph 4</p>\n</div>\n```\n\n`div` with a `.container` class is a wrapper for paragraphs.\n\n---\n\n### Fields' description\n\n* Name\n* Email\n* Message\n* I accept the terms of service\n\n## app.css\n\nAdd styles for _form-input_ following guidelines.\n\n* All child elements of the `form-input` class must be rendered as block-level elements and have a width of 100%\n* Text fields are 50 pixels high with 10 pixels vertical paddings and 20 pixels horizontal paddings. To preserve the size, change the behavior of the block model using the `box-sizing` property with a `border-box` value. Fields have a solid border of 1 pixel and the color `#e2e2e2`\n* The message field is 200 pixels high. Forbid the user from adjusting its size\n\n## Tips\n\nYou can select all child elements using `*`. For instance, here\n\n```css\n.block * {\n color: white;\n}\n```\n\nwe set white color for each child element of `.block`.\n\nYou can also use it with other combinators like `>`, then, the following selector\n\n```css\n.block > * {\n color: white;\n}\n```\n\nallows us to set white color for `.block` _immediate children_.\n","has_solution":true,"entity_name":"Forms"},"units":[{"id":5569,"name":"theory","url":"/courses/css-content/lessons/forms/theory_unit"},{"id":5570,"name":"quiz","url":"/courses/css-content/lessons/forms/quiz_unit"},{"id":5785,"name":"exercise","url":"/courses/css-content/lessons/forms/exercise_unit"}],"links":[{"id":424402,"name":"Form element attributes","url":"https://www.w3.org/TR/html52/sec-forms.html#configuring-a-form-to-communicate-with-a-server"},{"id":424403,"name":"Input types","url":"https://www.w3.org/TR/html52/sec-forms.html#sec-states-of-the-type-attribute"},{"id":424404,"name":"Resize property","url":"https://www.w3.org/TR/css-ui-3/#resize"}],"ordered_units":[{"id":5569,"name":"theory","url":"/courses/css-content/lessons/forms/theory_unit"},{"id":5570,"name":"quiz","url":"/courses/css-content/lessons/forms/quiz_unit"},{"id":5785,"name":"exercise","url":"/courses/css-content/lessons/forms/exercise_unit"}],"id":2469,"slug":"forms","state":"approved","name":"Forms","course_order":800,"goal":"Learn to create the cornerstone website element: form. Explore the standard elements of data input and form submission","self_study":"Create a user registration form for a website with the following fields:\n\n* First name\n* Last name\n* Login\n* Date of birth\n* Password\n\nUse different variations of `<input>` types. All possible types can be found in the additional information for this lesson.\n","theory_video_provider":null,"theory_video_uid":null,"theory":"Forms are an important interactive web page element. Like links, forms provide interaction between the user and the page, allowing data to be sent. There are special constructs in HTML for this that tell the browser which fields the user can use and how to handle them.\n\nThe forms are a far too big topic to cover in one lesson because all the possible nuances could make forms a course in and of themselves. Fear not – you'll learn here enough to be able to make good forms.\n\n## Creating a form\n\nA special tag, `<form>`, is used to separate the form from the rest of the layout. If you don't use it, the browser will not understand what data to send. After all, there can be several forms on a page.\n\n```html\n<form>\n <!-- Form Elements and Submit Button -->\n</form>\n```\n\n---\n\nThe server is a remote computer where the entire project is stored. You're now looking at a page that was generated on the server and given to you at a certain address. This address is currently listed in your browser.\n\n---\n\nAn example of interacting with a form is using a search engine, Google or Bing. You enter a search query, which is sent to the server. The server processes the results and gives you suitable sites. This interaction takes place using server-side programming languages such as PHP, Ruby, etc. When it comes to layout, we have no control over how the result is handled. The result is a set of tags used by the browser to collect data and send it to the server.\n\nThe `<form>` tag can take several different attributes. They're not required, but they can have a significant effect on your work. The most important of these is the `action` attribute. It allows you to specify the directory or file on the server where the data will be sent. If this attribute is not specified, the data will be sent to the same page where the form is located.\n\n```html\n<form action=\"/forms/helper.php\">\n <!-- The data from the form will be sent to the PHP file helper, which is located in the forms directory on the server -->\n</form>\n```\n\nYou'll understand the meaning of this action better if you're involved in backend development, for example, in PHP or Python. If you find it difficult right now, don't despair. The developers will always tell you where to send the data.\n\n## Form fields\n\nThe `<form>` tag alone is not enough to create a complete form because the user needs to enter some data. The easiest way is to give a text field where the user can enter information. HTML uses two tags for this:\n\n* `<input>` - a single tag that contains a small amount of information. This can be a phone number, email, date of birth, name, etc\n* `<textarea>` is a paired tag that allows the user to write more text. It can be a comment for an order or a review\n\n### textarea\n\nThe simplest tag is `<textarea>`. Its job is to create a large text box.\n\n```html\n<form>\n <textarea></textarea>\n</form>\n```\n\n<iframe height=\"265\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_textarea\" src=\"https://codepen.io/hexlet/embed/WNGPEjY?height=265&theme-id=light&default-tab=html,result&editable=true\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href='https://codepen.io/hexlet/pen/WNGPEjY'>css_content_course_forms_textarea</a> by Hexlet\n (<a href='https://codepen.io/hexlet'>@hexlet</a>) on <a href='https://codepen.io'>CodePen</a>.\n</iframe>\n\nIn the example, you can see the two attributes of the `<textarea>` tag: `cols` and `rows`. They are responsible for the number of characters and strings that are available inside _textarea_. If there's more content, then there'll be a scroll bar.\n\nTry resizing the `<textarea>` element. This can be done by pulling the bottom-right corner. You can do this not only to increase the width but also the height, too.\n\n\n\nThis behavior is often detrimental to our design. That's why developers don't allow it in most cases. There are several options here:\n\n* You can set the height and width of the element using CSS. Then the browser won't let the element be stretched\n* Use the `resize` property with the value set to `none`. Use it if your website doesn't support mobile browsers or Internet Explorer. For a complete list of supported browsers, visit the [Can I Use](https://caniuse.com/css-resize) website\n\n<iframe height=\"265\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_textarea-resize\" src=\"https://codepen.io/hexlet/embed/vYXbpGx?height=265&theme-id=light&default-tab=css,result&editable=true\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href='https://codepen.io/hexlet/pen/vYXbpGx'>css_content_course_forms_textarea-resize</a> by Hexlet\n (<a href='https://codepen.io/hexlet'>@hexlet</a>) on <a href='https://codepen.io'>CodePen</a>.\n</iframe>\n\n### input\n\nA large group of fields can be created using the `<input>` tag, the main attribute of which is `type`. It specifies exactly how the browser should handle the element. It makes no sense to look at each value individually because so much information will quickly be forgotten if it is not used.\n\nIn this lesson, we'll look at some of the most popular values for the `type` attribute.\n\n### `type=\"text\"`\n\nThe simplest kind is _input_, which allows you to enter any information from the user. This field doesn't have built-in validation, the only exception is removing line breaks before sending data to the server. If you want data with line breaks, use the `<textarea>` tag.\n\n```html\n<form>\n <input type=\"text\">\n</form>\n```\n\n<iframe height=\"265\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_input\" src=\"https://codepen.io/hexlet/embed/xxEMpOw?height=265&theme-id=light&default-tab=html,result&editable=true\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href='https://codepen.io/hexlet/pen/xxEMpOw'>css_content_course_forms_input</a> by Hexlet\n (<a href='https://codepen.io/hexlet'>@hexlet</a>) on <a href='https://codepen.io'>CodePen</a>.\n</iframe>\n\nNote that now the field is not marked in any way, making it totally unclear what the user needs to enter. The first thing that comes to mind is to add a heading or a paragraph before the field. Yes, this will give the appearance of a field description. But appearance is only one thing! In terms of semantics, there is no connection between the text and the input field. This is critical for users who use screen readers, as they might not realize that the field name and the field itself are connected.\n\n---\n\nA **screen reader** is a device for reading text from a screen. Used by people who are blind or visually impaired.\n\n---\n\nTo link the field and its name, we use the `<label>` tag and put text inside it. To link `<label>` and `<input>`, we can use one of two options. They're interchangeable, so you can use the one that's convenient for your particular situation.\n\n* Link by identifier. For this purpose, the `<input>` tag is given a unique `id`. The `<label>` is given the attribute `for`, whose value is the input's `id`\n\n```html\n<form>\n <label for=\"name\">Your name</label>\n <input id=\"name\" type=\"text\">\n</form>\n```\n\n* Embedding `<input>` inside `<label>`. This method means you don't have to give ids, but it can make the styling process a little more complicated\n\n```html\n<form>\n <label>Your name\n <input type=\"text\">\n </label>\n</form>\n```\n\n---\n\n**Important**: All elements that users can fill out must have a `<label>` tag. These are the `<input>` and `<textarea>` elements. This is true even if there is no visual caption for the field.\n\nYou can use the following CSS code to hide the element. As you grow as a developer, you'll get to understand all the rules described in this code. Usually, the used to hide an element is called `.sr-only`. This element will be invisible to the user, but the screen reader can read it.\n\n```css\n.sr-only {\n position: absolute;\n\n width: 1px;\n height: 1px;\n padding: 0;\n border: 0;\n overflow: hidden;\n\n white-space: nowrap;\n}\n```\n\n```html\n<form>\n <label for=\"name\" class=\"sr-only\">Your name</label>\n <input id=\"name\" type=\"text\">\n\n <!-- The label is now invisible to the user, but the screen reader can read it -->\n</form>\n```\n\n---\n\n### `type=\"radio\"`\n\nRadio buttons are used to select one option from multiple available ones. Why `radio`? There is a belief that this type got its name from the first car radios. There were several radio stations available, but only one could be chosen at a time. The meaning here is very similar to that of radio receivers.\n\nIn addition to the attributes used in the previous examples, there is another important attribute for radio buttons - `name`. It's unique to the _group_ of radio buttons.\n\n```html\n<form>\n <h2>Select a radio station</h2>\n <div>\n <label>\n <input type=\"radio\" name=\"radio-fm\" value=\"87.1 FM\">\n 87.1 FM\n </label>\n <br>\n\n <label>\n <input type=\"radio\" name=\"radio-fm\" value=\"95.5 FM\">\n 95.5 FM\n </label>\n <br>\n\n <label>\n <input type=\"radio\" name=\"radio-fm\" value=\"101.4 FM\">\n 101.4 FM\n </label>\n <br>\n\n <label>\n <input type=\"radio\" name=\"radio-fm\" value=\"103.2 FM\">\n 103.2 FM\n </label>\n </div>\n</form>\n```\n\n<iframe height=\"348\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_input_radio\" src=\"https://codepen.io/hexlet/embed/XWEJwjm?default-tab=html%2Cresult&editable=true&theme-id=light\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href=\"https://codepen.io/hexlet/pen/XWEJwjm\">\n css_content_course_forms_input_radio</a> by Hexlet (<a href=\"https://codepen.io/hexlet\">@hexlet</a>)\n on <a href=\"https://codepen.io\">CodePen</a>.\n</iframe>\n\nIn addition to the `name` attribute, radio buttons also use the `value` attribute. Inside it is the value that will be sent to the server.\n\n### `type=\"checkbox\"`\n\nCheckboxes are a bit like radio buttons, but have a significant difference - you can select several values at once. Imagine the user is choosing their favorite dishes. It's probably more than one dish. They could use `<textarea>`, but checkboxes are preferable.\n\n```html\n<form>\n <h2>Your favorite dishes</h2>\n <div>\n <label>\n <input type=\"checkbox\" name=\"dishes\" value=\"pizza\">\n Pizza\n </label>\n <br>\n\n <label>\n <input type=\"checkbox\" name=\"dishes\" value=\"burger\">\n Burgers\n </label>\n <br>\n\n <label>\n <input type=\"checkbox\" name=\"dishes\" value=\"paste\">\n Pasta\n </label>\n </div>\n</form>\n```\n\n<iframe height=\"347\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_input_checkbox\" src=\"https://codepen.io/hexlet/embed/YzaPbGr?default-tab=html%2Cresult&editable=true&theme-id=light\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href=\"https://codepen.io/hexlet/pen/YzaPbGr\">\n css_content_course_forms_input_checkbox</a> by Hexlet (<a href=\"https://codepen.io/hexlet\">@hexlet</a>)\n on <a href=\"https://codepen.io\">CodePen</a>.\n</iframe>\n\n## Lists\n\nLists are separate elements in forms. Imagine a filter on a tech store website. You can only filter items in one category at a time. You can use radio buttons for this, or even checkboxes in the case of multiple choices. But there is another way, you can use a list.\n\nCreating a list is very similar to creating a piece of text that's a list. We use the `<select>` select tags for this in forms, and its items are found inside `<option>` tags.\n\n```html\n<form>\n <h2>Category</h2>\n <select name=\"category\">\n <option value=\"computer\">PC</option>\n <option value=\"phone\" selected>Smartphones</option>\n <option value=\"appliances\">Home appliances</option>\n </select>\n</form>\n```\n\n<iframe height=\"300\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_select\" src=\"https://codepen.io/hexlet/embed/WNzbBGP?default-tab=html%2Cresult&editable=true&theme-id=light\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href=\"https://codepen.io/hexlet/pen/WNzbBGP\">\n css_content_course_forms_select</a> by Hexlet (<a href=\"https://codepen.io/hexlet\">@hexlet</a>)\n on <a href=\"https://codepen.io\">CodePen</a>.\n</iframe>\n\nIn the example, there is a new attribute - `selected`. It's responsible for which item is selected by default. If it's not specified, the first item in the list will be selected.\n\nFor radio button and checkbox elements, the `checked` attribute is used by default.\n\nThere's another interesting attribute is available for lists, `multiple`. With it, the list becomes similar to checkboxes and allows you to select several items.\n\n```html\n<form>\n <h2>Category</h2>\n <select name=\"category\" multiple>\n <option value=\"computer\">PC</option>\n <option value=\"phone\" selected>Smartphones</option>\n <option value=\"appliances\" selected>Home appliances</option>\n </select>\n</form>\n```\n\n<iframe height=\"300\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_select_multi\" src=\"https://codepen.io/hexlet/embed/yLKyWam?default-tab=html%2Cresult&editable=true&theme-id=light\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href=\"https://codepen.io/hexlet/pen/yLKyWam\">\n css_content_course_forms_select_multi</a> by Hexlet (<a href=\"https://codepen.io/hexlet\">@hexlet</a>)\n on <a href=\"https://codepen.io\">CodePen</a>.\n</iframe>\n\n## Submittig the form\n\nIn the last section, we looked at the different ways in which the user and the form can interact. But it doesn't make any sense if the form won't be sent. To do this, you need to create an element that will send a form when interacted with.\n\nThe form can be sent in one of two ways:\n\n* Create an `<input>` with type `submit`. In this case, an element will be created in the form of a button with the name specified as the value of the `value` attribute\n* Using a paired `<button>` tag. This method gives your more opportunities because the button can contain any HTML code, which, when clicked, will send the form. This method is very convenient for creating a button that's an icon. Right now, this method is the most popular\n\n<iframe height=\"353\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_button\" src=\"https://codepen.io/hexlet/embed/LYdEobW?default-tab=html%2Cresult&editable=true&theme-id=light\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href=\"https://codepen.io/hexlet/pen/LYdEobW\">\n css_content_course_forms_button</a> by Hexlet (<a href=\"https://codepen.io/hexlet\">@hexlet</a>)\n on <a href=\"https://codepen.io\">CodePen</a>.\n</iframe>\n\n## Separating form sections\n\nForms that aren't separated into sections are a nightmare for users. Once you get to the middle of the form, you'll have no idea which fields are filled with what. You can separate sections with headers or visually. But browsers provide a special mechanism for dividing sections of the form into logical sections - `fieldset`. They can be seen as an alternative to the `<section>` tag, but only for forms. The `<legend>` tag is used as the header.\n\n```html\n<form>\n <fieldset>\n <legend>User Data</legend>\n <label>\n First Name\n <input type=\"text\" name=\"name\">\n </label>\n <br>\n\n <label>\n Last Name\n <input type=\"text\" name=\"surname\">\n </label>\n </fieldset>\n <fieldset>\n <legend>Delivery method</legend>\n <label>\n Courier\n <input type=\"radio\" name=\"delivery\" value=\"courier\">\n </label>\n <br>\n\n <label>\n Pickup\n <input type=\"radio\" name=\"delivery\" value=\"pickup\">\n </label>\n </fieldset>\n\n <button>Order</button>\n</form>\n```\n\n<iframe height=\"521\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_fieldset\" src=\"https://codepen.io/hexlet/embed/ExEazZK?default-tab=html%2Cresult&editable=true&theme-id=light\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href=\"https://codepen.io/hexlet/pen/ExEazZK\">\n css_content_course_forms_fieldset</a> by Hexlet (<a href=\"https://codepen.io/hexlet\">@hexlet</a>)\n on <a href=\"https://codepen.io\">CodePen</a>.\n</iframe>\n\n## Text inside a text box\n\nIn all the examples in this lesson, the text fields were originally blank. You've probably often seen that there is text in the field before you click on it, inviting you to enter data or showing the format of the expected input.\n\nThe `placeholder` attribute, whose value is the text that is displayed before you click on it (actually, before `focus` event).\n\n```html\n<form>\n <fieldset>\n <legend>User Data</legend>\n <label>\n First Name\n <input type=\"text\" name=\"name\" placeholder=\"Enter your first name\">\n </label>\n <br>\n\n <label>\n Last Name\n <input type=\"text\" name=\"surname\" placeholder=\"Enter your last name\">\n </label>\n </fieldset>\n <button>Submit</button>\n</form>\n```\n\n<iframe height=\"373\" style=\"width: 100%;\" scrolling=\"no\" title=\"css_content_course_forms_placeholder\" src=\"https://codepen.io/hexlet/embed/RwMNmKx?default-tab=html%2Cresult&editable=true&theme-id=light\" frameborder=\"no\" loading=\"lazy\" allowtransparency=\"true\" allowfullscreen=\"true\">\n See the Pen <a href=\"https://codepen.io/hexlet/pen/RwMNmKx\">\n css_content_course_forms_placeholder</a> by Hexlet (<a href=\"https://codepen.io/hexlet\">@hexlet</a>)\n on <a href=\"https://codepen.io\">CodePen</a>.\n</iframe>\n\n---\n\n**Important**: `placeholder` is not a replacement for the `<label>` tag. Think of _placeholder_ as the description of a text field, and `<label>` as the name of that field.\n\n---\n"},"lessonMember":null,"courseMember":null,"course":{"start_lesson":{"exercise":null,"units":[{"id":5562,"name":"theory","url":"/courses/css-content/lessons/intro/theory_unit"}],"links":[],"ordered_units":[{"id":5562,"name":"theory","url":"/courses/css-content/lessons/intro/theory_unit"}],"id":2465,"slug":"intro","state":"approved","name":"Intro","course_order":50,"goal":"Learn about the course topics and goals. Get to know the lesson structure and features","self_study":null,"theory_video_provider":null,"theory_video_uid":null,"theory":"\nWorking with content is an essential aspect of any project. Behind all the beautiful animations, panels, and images is all sorts of hidden content. The content is what the user comes to a website or opens an app for. The user's mood often depends on how good the content looks and feels.\n\nIn this course, we'll go through the fundamentals of working with content and how to make animations. You'll learn:\n\n* how to create styles for fonts and lists\n* how to create and style tables\n* how to use columns using the `columns` property\n* about the different units of measurement and how to work with them\n* how to create forms and use media elements\n* the basic rules of animation and typography\n* how to make content accessible\n\n## Practice\n\nMany of the lessons in this course will include a practice section with a web view. It's a good idea to do more than just complete the task. Once you've completed the task successfully, try experimenting with the code and the features you've learned.\n\nPractice segments in this course are built around a system of snapshot testing. Unlike other courses, this one doesn't check against the values you specify, but rather takes a screenshot of the page with your styles and compares it to the screenshots from the teacher's solution. You can easily see how the page should look at different _viewport_ resolutions.\n\nYou can see screenshots with styles from the teacher's solution in \\_\\_tests__/__image_snapshots\\_\\_.\n\n## Testing the solution\n\nStudents' solutions are mostly tested using the _Visual Regression Testing_ method, i.e., by _comparing screenshots_. Without going into technical details, the test is as follows:\n\n1. The exercise contains reference screenshots that were taken based on the teacher's solution\n2. When you click on the \"Check\" button, the student's solution is sent to a Chromium-based browser and screenshotted\n3. The screenshot is compared with the reference screenshot, and then the tests give a text result of the comparison\n\nIf there's a difference of more than 2% detected, the system will produce one of two possible errors:\n\n### Different sizes of screenshots\n\n\n\nThe system says that the dimensions of the images do not match. In this example, the reference screenshot is `370px x 558px`, and the comparison screenshot is `370px x 524px`.\n\nMost likely, there is a problem with the indentation/height or line spacing. Carefully analyze the screenshots, in the `__diff_output__` directory. The specific path is given in the test output, and the files can be found in the left area of the exercise.\n\nYou'll find two files:\n\n* _name-test-actual.jpg_ – the screenshot of your solution\n* _name-test-expected.jpg_ – the reference screenshot\n\n### Visual Differences\n\n\n\nIn this test, the system is reporting that the images have an 810-pixel difference. In this case, three files are generated instead of two:\n\n* _name-test-actual.jpg_ – the screenshot of your solution\n* _name-test-expected.jpg_ – the reference screenshot\n* _name-test-diff.jpg_ - the screenshot obtained by overlaying the student's screenshot and the reference screenshot. This is how you see the areas that are different\n\nThe screenshot with the differences looks something like this:\n\n\n\nThe places where the differences were found are highlighted in red. In this case, you can compare the screenshots yourself.\n\n---\n\n**Important**: fix the differences going from top to bottom. Often there is a situation where a small error in the indentation affects the entire screenshot. It looks like everything is wrong, but only one property needs to be fixed\n\n---\n\n### CodePen\n\nAnother opportunity to apply the skills learned in the course is to use the [CodePen](https://codepen.io) service. You can create your own pen, where you can experiment with properties.\n\nAdditionally, there'll be examples that are loaded from **CodePen** in each lesson of the course. They're available for review, and you can make edits in real-time and monitor the result. Don't miss out on this opportunity.\n\nDon't forget to practice all the time, that way you boost your content markup skills and be able to quickly and skillfully design all the content on a page or app.\n"},"id":262,"slug":"css-content","challenges_count":4,"name":"Content layout fundamentals","allow_indexing":true,"state":"approved","course_state":"finished","pricing_type":"paid","description":"The course focuses on working with content using CSS and HTML. To date, stylesheets provide great opportunities for styling text and blocks on the page: background, color, handling audio, and video. All these elements allow you to create colorful, responsive, and accessible websites for users. A lot of time here we devote to new selectors, pseudo-classes, and pseudo-elements, they allow you to style the content in an extraordinary way","kind":"basic","updated_at":"2026-01-20T11:46:47.674Z","language":"html","duration_cache":58860,"skills":["Mark up text, lists, tables, and media elements properly","Create tables","Access elements using the selectors' extended features","Adapt pages for people with disabilities","Use CSS Columns features","Connect fonts and use them properly"],"keywords":[],"lessons_count":17,"cover":"https://hexlet.io/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6NzY1NCwicHVyIjoiYmxvYl9pZCJ9fQ==--94a75137964596fce27b712fcdda86bb08576a70/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJwbmciLCJyZXNpemVfdG9fZmlsbCI6WzYwMCw0MDBdfSwicHVyIjoidmFyaWF0aW9uIn19--6067466c2912ca31a17eddee04b8cf2a38c6ad17/image.png"},"recommendedLandings":[{"stack":{"id":15,"slug":"frontend","title":"Frontend Developer","audience":"for_beginners","start_type":"anytime","pricing_model":"purchase","priority":"low","kind":"profession","state":"published","stack_state":"finished","order":1,"duration_in_months":10},"id":22,"slug":"frontend","title":"Frontend Developer","subtitle":"","subtitle_for_lists":"","locale":"en","current":true,"duration_in_months_text":"10 months","stack_slug":"frontend","price_text":"from $49","duration_text":"10 months","cover_list_variant":"https://hexlet.io/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MTIzNTMsInB1ciI6ImJsb2JfaWQifX0=--f1948fb0c5a45a6d76671a1a32b8cf6f0b53ee57/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbNDAwLDQwMF0sInNhdmVyIjp7InF1YWxpdHkiOjg1fX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--5b6f46dacd1af664f27558553a58076185091823/Software%20code%20testing-cuate.png"}],"lessonMemberUnit":null,"accessToLearnUnitExists":false,"accessToCourseExists":false},"url":"/courses/css-content/lessons/forms/theory_unit","version":"1656487db0d1dd5f33634fe1070e57e55135cbeb","encryptHistory":false,"clearHistory":false}"><style data-mantine-styles="true">:root, :host{--mantine-font-family: Arial, sans-serif;--mantine-font-family-headings: Arial, sans-serif;--mantine-heading-font-weight: normal;--mantine-radius-default: 0rem;--mantine-primary-color-filled: var(--mantine-color-indigo-filled);--mantine-primary-color-filled-hover: var(--mantine-color-indigo-filled-hover);--mantine-primary-color-light: var(--mantine-color-indigo-light);--mantine-primary-color-light-hover: var(--mantine-color-indigo-light-hover);--mantine-primary-color-light-color: var(--mantine-color-indigo-light-color);--mantine-spacing-xxl: calc(4rem * var(--mantine-scale));--mantine-font-size-xs: 12px;--mantine-font-size-sm: 14px;--mantine-font-size-md: 16px;--mantine-font-size-lg: clamp(16.0000px, calc(15.2727px + 0.2273vw), 18.0000px);--mantine-font-size-xl: clamp(16.0000px, calc(14.5455px + 0.4545vw), 20.0000px);--mantine-font-size-display-3: clamp(32.0000px, calc(26.1818px + 1.8182vw), 48.0000px);--mantine-font-size-display-2: clamp(36.0000px, calc(25.8182px + 3.1818vw), 64.0000px);--mantine-font-size-display-1: clamp(40.0000px, calc(25.4545px + 4.5455vw), 80.0000px);--mantine-font-size-h1: clamp(28.0000px, calc(23.6364px + 1.3636vw), 40.0000px);--mantine-font-size-h2: clamp(24.0000px, calc(21.0909px + 0.9091vw), 32.0000px);--mantine-font-size-h3: clamp(20.0000px, calc(17.0909px + 0.9091vw), 28.0000px);--mantine-font-size-h4: clamp(16.0000px, calc(13.0909px + 0.9091vw), 24.0000px);--mantine-font-size-h5: clamp(16.0000px, calc(14.5455px + 0.4545vw), 20.0000px);--mantine-font-size-h6: 1rem;--mantine-primary-color-0: var(--mantine-color-indigo-0);--mantine-primary-color-1: var(--mantine-color-indigo-1);--mantine-primary-color-2: var(--mantine-color-indigo-2);--mantine-primary-color-3: var(--mantine-color-indigo-3);--mantine-primary-color-4: var(--mantine-color-indigo-4);--mantine-primary-color-5: var(--mantine-color-indigo-5);--mantine-primary-color-6: var(--mantine-color-indigo-6);--mantine-primary-color-7: var(--mantine-color-indigo-7);--mantine-primary-color-8: var(--mantine-color-indigo-8);--mantine-primary-color-9: var(--mantine-color-indigo-9);--mantine-color-red-0: #ffeaea;--mantine-color-red-1: #fed4d4;--mantine-color-red-2: #f4a7a8;--mantine-color-red-3: #ec7878;--mantine-color-red-4: #e55050;--mantine-color-red-5: #e03131;--mantine-color-red-6: #e02829;--mantine-color-red-7: #c71a1c;--mantine-color-red-8: #b21218;--mantine-color-red-9: #9c0411;--mantine-color-violet-0: #fce9ff;--mantine-color-violet-1: #f1cfff;--mantine-color-violet-2: #e09bff;--mantine-color-violet-3: #d16fff;--mantine-color-violet-4: #be37fe;--mantine-color-violet-5: #b51afe;--mantine-color-violet-6: #b009ff;--mantine-color-violet-7: #9b00e4;--mantine-color-violet-8: #8a00cc;--mantine-color-violet-9: #7800b3;--mantine-color-indigo-0: #edecff;--mantine-color-indigo-1: #d6d5fe;--mantine-color-indigo-2: #aaa9f4;--mantine-color-indigo-3: #7b79eb;--mantine-color-indigo-4: #5451e4;--mantine-color-indigo-5: #3b37e0;--mantine-color-indigo-6: #2d2adf;--mantine-color-indigo-7: #1f1ec7;--mantine-color-indigo-8: #1819b2;--mantine-color-indigo-9: #0c149e;--mantine-color-cyan-0: #dffdff;--mantine-color-cyan-1: #caf5ff;--mantine-color-cyan-2: #99e8ff;--mantine-color-cyan-3: #64daff;--mantine-color-cyan-4: #3ccffe;--mantine-color-cyan-5: #24c8fe;--mantine-color-cyan-6: #00c2ff;--mantine-color-cyan-7: #00ade4;--mantine-color-cyan-8: #009acd;--mantine-color-cyan-9: #0085b5;--mantine-color-green-0: #e9fdec;--mantine-color-green-1: #d7f6dc;--mantine-color-green-2: #b0eab9;--mantine-color-green-3: #86df94;--mantine-color-green-4: #62d574;--mantine-color-green-5: #4ccf5f;--mantine-color-green-6: #3fcc54;--mantine-color-green-7: #2fb344;--mantine-color-green-8: #25a03b;--mantine-color-green-9: #138a2e;--mantine-color-yellow-0: #fff7e2;--mantine-color-yellow-1: #ffeecd;--mantine-color-yellow-2: #ffdc9c;--mantine-color-yellow-3: #ffc966;--mantine-color-yellow-4: #feb93a;--mantine-color-yellow-5: #feae1e;--mantine-color-yellow-6: #ffa90f;--mantine-color-yellow-8: #ca8200;--mantine-color-yellow-9: #af7000;--mantine-h1-font-size: clamp(28.0000px, calc(23.6364px + 1.3636vw), 40.0000px);--mantine-h1-font-weight: normal;--mantine-h2-font-size: clamp(24.0000px, calc(21.0909px + 0.9091vw), 32.0000px);--mantine-h2-font-weight: normal;--mantine-h3-font-size: clamp(20.0000px, calc(17.0909px + 0.9091vw), 28.0000px);--mantine-h3-font-weight: normal;--mantine-h4-font-size: clamp(16.0000px, calc(13.0909px + 0.9091vw), 24.0000px);--mantine-h4-font-weight: normal;--mantine-h5-font-size: clamp(16.0000px, calc(14.5455px + 0.4545vw), 20.0000px);--mantine-h5-font-weight: normal;--mantine-h6-font-size: 1rem;--mantine-h6-font-weight: normal;}
:root[data-mantine-color-scheme="dark"], :host([data-mantine-color-scheme="dark"]){--mantine-color-anchor: var(--mantine-color-text);--mantine-color-dimmed: #495057;--mantine-color-dark-filled: var(--mantine-color-dark-5);--mantine-color-dark-filled-hover: var(--mantine-color-dark-6);--mantine-color-dark-light: rgba(105, 105, 105, 0.15);--mantine-color-dark-light-hover: rgba(105, 105, 105, 0.2);--mantine-color-dark-light-color: var(--mantine-color-dark-0);--mantine-color-dark-outline: var(--mantine-color-dark-1);--mantine-color-dark-outline-hover: rgba(184, 184, 184, 0.05);--mantine-color-gray-filled: var(--mantine-color-gray-5);--mantine-color-gray-filled-hover: var(--mantine-color-gray-6);--mantine-color-gray-light: rgba(222, 226, 230, 0.15);--mantine-color-gray-light-hover: rgba(222, 226, 230, 0.2);--mantine-color-gray-light-color: var(--mantine-color-gray-0);--mantine-color-gray-outline: var(--mantine-color-gray-1);--mantine-color-gray-outline-hover: rgba(241, 243, 245, 0.05);--mantine-color-red-filled: var(--mantine-color-red-5);--mantine-color-red-filled-hover: var(--mantine-color-red-6);--mantine-color-red-light: rgba(236, 120, 120, 0.15);--mantine-color-red-light-hover: rgba(236, 120, 120, 0.2);--mantine-color-red-light-color: var(--mantine-color-red-0);--mantine-color-red-outline: var(--mantine-color-red-1);--mantine-color-red-outline-hover: rgba(254, 212, 212, 0.05);--mantine-color-pink-filled: var(--mantine-color-pink-5);--mantine-color-pink-filled-hover: var(--mantine-color-pink-6);--mantine-color-pink-light: rgba(250, 162, 193, 0.15);--mantine-color-pink-light-hover: rgba(250, 162, 193, 0.2);--mantine-color-pink-light-color: var(--mantine-color-pink-0);--mantine-color-pink-outline: var(--mantine-color-pink-1);--mantine-color-pink-outline-hover: rgba(255, 222, 235, 0.05);--mantine-color-grape-filled: var(--mantine-color-grape-5);--mantine-color-grape-filled-hover: var(--mantine-color-grape-6);--mantine-color-grape-light: rgba(229, 153, 247, 0.15);--mantine-color-grape-light-hover: rgba(229, 153, 247, 0.2);--mantine-color-grape-light-color: var(--mantine-color-grape-0);--mantine-color-grape-outline: var(--mantine-color-grape-1);--mantine-color-grape-outline-hover: rgba(243, 217, 250, 0.05);--mantine-color-violet-filled: var(--mantine-color-violet-5);--mantine-color-violet-filled-hover: var(--mantine-color-violet-6);--mantine-color-violet-light: rgba(209, 111, 255, 0.15);--mantine-color-violet-light-hover: rgba(209, 111, 255, 0.2);--mantine-color-violet-light-color: var(--mantine-color-violet-0);--mantine-color-violet-outline: var(--mantine-color-violet-1);--mantine-color-violet-outline-hover: rgba(241, 207, 255, 0.05);--mantine-color-indigo-filled: var(--mantine-color-indigo-5);--mantine-color-indigo-filled-hover: var(--mantine-color-indigo-6);--mantine-color-indigo-light: rgba(123, 121, 235, 0.15);--mantine-color-indigo-light-hover: rgba(123, 121, 235, 0.2);--mantine-color-indigo-light-color: var(--mantine-color-indigo-0);--mantine-color-indigo-outline: var(--mantine-color-indigo-1);--mantine-color-indigo-outline-hover: rgba(214, 213, 254, 0.05);--mantine-color-blue-filled: var(--mantine-color-blue-5);--mantine-color-blue-filled-hover: var(--mantine-color-blue-6);--mantine-color-blue-light: rgba(116, 192, 252, 0.15);--mantine-color-blue-light-hover: rgba(116, 192, 252, 0.2);--mantine-color-blue-light-color: var(--mantine-color-blue-0);--mantine-color-blue-outline: var(--mantine-color-blue-1);--mantine-color-blue-outline-hover: rgba(208, 235, 255, 0.05);--mantine-color-cyan-filled: var(--mantine-color-cyan-5);--mantine-color-cyan-filled-hover: var(--mantine-color-cyan-6);--mantine-color-cyan-light: rgba(100, 218, 255, 0.15);--mantine-color-cyan-light-hover: rgba(100, 218, 255, 0.2);--mantine-color-cyan-light-color: var(--mantine-color-cyan-0);--mantine-color-cyan-outline: var(--mantine-color-cyan-1);--mantine-color-cyan-outline-hover: rgba(202, 245, 255, 0.05);--mantine-color-teal-filled: var(--mantine-color-teal-5);--mantine-color-teal-filled-hover: var(--mantine-color-teal-6);--mantine-color-teal-light: rgba(99, 230, 190, 0.15);--mantine-color-teal-light-hover: rgba(99, 230, 190, 0.2);--mantine-color-teal-light-color: var(--mantine-color-teal-0);--mantine-color-teal-outline: var(--mantine-color-teal-1);--mantine-color-teal-outline-hover: rgba(195, 250, 232, 0.05);--mantine-color-green-filled: var(--mantine-color-green-5);--mantine-color-green-filled-hover: var(--mantine-color-green-6);--mantine-color-green-light: rgba(134, 223, 148, 0.15);--mantine-color-green-light-hover: rgba(134, 223, 148, 0.2);--mantine-color-green-light-color: var(--mantine-color-green-0);--mantine-color-green-outline: var(--mantine-color-green-1);--mantine-color-green-outline-hover: rgba(215, 246, 220, 0.05);--mantine-color-lime-filled: var(--mantine-color-lime-5);--mantine-color-lime-filled-hover: var(--mantine-color-lime-6);--mantine-color-lime-light: rgba(192, 235, 117, 0.15);--mantine-color-lime-light-hover: rgba(192, 235, 117, 0.2);--mantine-color-lime-light-color: var(--mantine-color-lime-0);--mantine-color-lime-outline: var(--mantine-color-lime-1);--mantine-color-lime-outline-hover: rgba(233, 250, 200, 0.05);--mantine-color-yellow-filled: var(--mantine-color-yellow-5);--mantine-color-yellow-filled-hover: var(--mantine-color-yellow-6);--mantine-color-yellow-light: rgba(255, 201, 102, 0.15);--mantine-color-yellow-light-hover: rgba(255, 201, 102, 0.2);--mantine-color-yellow-light-color: var(--mantine-color-yellow-0);--mantine-color-yellow-outline: var(--mantine-color-yellow-1);--mantine-color-yellow-outline-hover: rgba(255, 238, 205, 0.05);--mantine-color-orange-filled: var(--mantine-color-orange-5);--mantine-color-orange-filled-hover: var(--mantine-color-orange-6);--mantine-color-orange-light: rgba(255, 192, 120, 0.15);--mantine-color-orange-light-hover: rgba(255, 192, 120, 0.2);--mantine-color-orange-light-color: var(--mantine-color-orange-0);--mantine-color-orange-outline: var(--mantine-color-orange-1);--mantine-color-orange-outline-hover: rgba(255, 232, 204, 0.05);--app-cta-gradient: linear-gradient(90deg, var(--mantine-color-blue-9) 0%, var(--mantine-color-cyan-7) 100%);--app-color-surface: #2e2e2e;}
:root[data-mantine-color-scheme="light"], :host([data-mantine-color-scheme="light"]){--mantine-color-anchor: var(--mantine-color-text);--mantine-color-dimmed: #495057;--mantine-color-red-light: rgba(224, 40, 41, 0.1);--mantine-color-red-light-hover: rgba(224, 40, 41, 0.12);--mantine-color-red-outline-hover: rgba(224, 40, 41, 0.05);--mantine-color-violet-light: rgba(176, 9, 255, 0.1);--mantine-color-violet-light-hover: rgba(176, 9, 255, 0.12);--mantine-color-violet-outline-hover: rgba(176, 9, 255, 0.05);--mantine-color-indigo-light: rgba(45, 42, 223, 0.1);--mantine-color-indigo-light-hover: rgba(45, 42, 223, 0.12);--mantine-color-indigo-outline-hover: rgba(45, 42, 223, 0.05);--mantine-color-cyan-light: rgba(0, 194, 255, 0.1);--mantine-color-cyan-light-hover: rgba(0, 194, 255, 0.12);--mantine-color-cyan-outline-hover: rgba(0, 194, 255, 0.05);--mantine-color-green-light: rgba(63, 204, 84, 0.1);--mantine-color-green-light-hover: rgba(63, 204, 84, 0.12);--mantine-color-green-outline-hover: rgba(63, 204, 84, 0.05);--mantine-color-yellow-light: rgba(255, 169, 15, 0.1);--mantine-color-yellow-light-hover: rgba(255, 169, 15, 0.12);--mantine-color-yellow-outline-hover: rgba(255, 169, 15, 0.05);--app-color-surface: #f1f3f5;--app-cta-gradient: linear-gradient(90deg, var(--mantine-color-blue-filled) 0%, var(--mantine-color-cyan-5) 100%);}</style><style data-mantine-styles="classes">@media (max-width: 35.99375em) {.mantine-visible-from-xs {display: none !important;}}@media (min-width: 36em) {.mantine-hidden-from-xs {display: none !important;}}@media (max-width: 47.99375em) {.mantine-visible-from-sm {display: none !important;}}@media (min-width: 48em) {.mantine-hidden-from-sm {display: none !important;}}@media (max-width: 61.99375em) {.mantine-visible-from-md {display: none !important;}}@media (min-width: 62em) {.mantine-hidden-from-md {display: none !important;}}@media (max-width: 74.99375em) {.mantine-visible-from-lg {display: none !important;}}@media (min-width: 75em) {.mantine-hidden-from-lg {display: none !important;}}@media (max-width: 87.99375em) {.mantine-visible-from-xl {display: none !important;}}@media (min-width: 88em) {.mantine-hidden-from-xl {display: none !important;}}</style><div style="position:absolute;top:0rem" class=""></div><div style="max-width:var(--container-size-xl);height:100%;min-height:0rem" class=""><style data-mantine-styles="inline">.__m__-_R_5ub_{--grid-gutter:0rem;}</style><div style="height:100%;min-height:0rem" class="m_410352e9 mantine-Grid-root __m__-_R_5ub_"><div class="m_dee7bd2f mantine-Grid-inner" style="height:100%"><style data-mantine-styles="inline">.__m__-_R_rdub_{--col-flex-grow:auto;--col-flex-basis:91.66666666666667%;--col-max-width:91.66666666666667%;}@media(min-width: 48em){.__m__-_R_rdub_{--col-flex-grow:auto;--col-flex-basis:83.33333333333334%;--col-max-width:83.33333333333334%;}}</style><div style="min-width:0rem;height:100%;min-height:0rem;display:flex" class="m_96bdd299 mantine-Grid-col __m__-_R_rdub_"><style data-mantine-styles="inline">.__m__-_R_6qrdub_{margin-top:0rem;padding-inline:var(--mantine-spacing-xs);width:100%;}@media(min-width: 48em){.__m__-_R_6qrdub_{margin-top:var(--mantine-spacing-xl);width:80%;}}@media(min-width: 62em){.__m__-_R_6qrdub_{padding-inline:var(--mantine-spacing-xl);}}</style><div style="margin-inline:auto;max-width:var(--mantine-breakpoint-xl)" class="__m__-_R_6qrdub_"><div style="color:var(--mantine-color-dimmed)" class="m_4451eb3a mantine-Center-root" data-inline="true"><div style="--ti-size:var(--ti-size-xs);--ti-bg:transparent;--ti-color:var(--mantine-color-indigo-light-color);--ti-bd:calc(0.0625rem * var(--mantine-scale)) solid transparent;margin-inline-end:calc(0.125rem * var(--mantine-scale));color:inherit" class="m_7341320d mantine-ThemeIcon-root" data-variant="transparent" data-size="xs"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-lock "><path d="M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path></svg></div><p style="font-size:var(--mantine-font-size-sm)" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">Content layout fundamentals</p></div><h1 style="--title-fw:var(--mantine-h1-font-weight);--title-lh:var(--mantine-h1-line-height);--title-fz:var(--mantine-h1-font-size);margin-bottom:var(--mantine-spacing-xl)" class="m_8a5d1357 mantine-Title-root" data-order="1">Theory: Forms</h1><script type="application/ld+json">{"@context":"https://schema.org","@type":"LearningResource","name":"Forms","inLanguage":"en","isPartOf":{"@type":"LearningResource","name":"Content layout fundamentals"},"isAccessibleForFree":"False","hasPart":{"@type":"WebPageElement","isAccessibleForFree":"False","cssSelector":".paywalled"}}</script><div class=""><div style="--alert-color:var(--mantine-color-indigo-light-color);margin-bottom:var(--mantine-spacing-lg);font-size:var(--mantine-font-size-lg)" class="m_66836ed3 mantine-Alert-root" id="mantine-_R_remqrdub_" role="alert" aria-describedby="mantine-_R_remqrdub_-body" aria-labelledby="mantine-_R_remqrdub_-title"><div class="m_a5d60502 mantine-Alert-wrapper"><div class="m_667f2a6a mantine-Alert-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-rocket "><path d="M4 13a8 8 0 0 1 7 7a6 6 0 0 0 3 -5a9 9 0 0 0 6 -8a3 3 0 0 0 -3 -3a9 9 0 0 0 -8 6a6 6 0 0 0 -5 3"></path><path d="M7 14a6 6 0 0 0 -3 6a6 6 0 0 0 6 -3"></path><path d="M14 9a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path></svg></div><div class="m_667c2793 mantine-Alert-body"><div class="m_6a03f287 mantine-Alert-title"><span id="mantine-_R_remqrdub_-title" class="m_698f4f23 mantine-Alert-label">Full access to materials</span></div><div id="mantine-_R_remqrdub_-body" class="m_7fa78076 mantine-Alert-message"><div style="--group-gap:var(--mantine-spacing-md);--group-align:center;--group-justify:space-between;--group-wrap:wrap" class="m_4081bf90 mantine-Group-root"><p class="mantine-focus-auto m_b6d8b162 mantine-Text-root">Sign up and get access to this and dozens of other courses</p><a style="--button-height:var(--button-height-xs);--button-padding-x:var(--button-padding-x-xs);--button-fz:var(--mantine-font-size-xs);--button-bg:linear-gradient(45deg, var(--mantine-color-blue-filled) 0%, var(--mantine-color-cyan-filled) 100%);--button-hover:linear-gradient(45deg, var(--mantine-color-blue-filled) 0%, var(--mantine-color-cyan-filled) 100%);--button-color:var(--mantine-color-white);--button-bd:none" class="mantine-focus-auto mantine-active m_77c9d27d mantine-Button-root m_87cf2631 mantine-UnstyledButton-root" data-variant="gradient" data-size="xs" href="/u/new"><span class="m_80f1301b mantine-Button-inner"><span class="m_811560b9 mantine-Button-label">Sign up</span></span></a></div></div></div></div></div><div class="paywalled m_d08caa0 mantine-Typography-root"><p>Forms are an important interactive web page element. Like links, forms provide interaction between the user and the page, allowing data to be sent. There are special constructs in HTML for this that tell the browser which fields the user can use and how to handle them.</p>
<p>The forms are a far too big topic to cover in one lesson because all the possible nuances could make forms a course in and of themselves. Fear not – you'll learn here enough to be able to make good forms.</p>
<h2 id="heading-2-1">Creating a form</h2>
<p>A special tag, <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><form></code>, is used to separate the form from the rest of the layout. If you don't use it, the browser will not understand what data to send. After all, there can be several forms on a page.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<!-- Form Elements and Submit Button -->
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<hr/>
<p>The server is a remote computer where the entire project is stored. You're now looking at a page that was generated on the server and given to you at a certain address. This address is currently listed in your browser.</p>
<hr/>
<p>An example of interacting with a form is using a search engine, Google or Bing. You enter a search query, which is sent to the server. The server processes the results and gives you suitable sites. This interaction takes place using server-side programming languages such as PHP, Ruby, etc. When it comes to layout, we have no control over how the result is handled. The result is a set of tags used by the browser to collect data and send it to the server.</p>
<p>The <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><form></code> tag can take several different attributes. They're not required, but they can have a significant effect on your work. The most important of these is the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">action</code> attribute. It allows you to specify the directory or file on the server where the data will be sent. If this attribute is not specified, the data will be sent to the same page where the form is located.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form action="/forms/helper.php">
<!-- The data from the form will be sent to the PHP file helper, which is located in the forms directory on the server -->
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<p>You'll understand the meaning of this action better if you're involved in backend development, for example, in PHP or Python. If you find it difficult right now, don't despair. The developers will always tell you where to send the data.</p>
<h2 id="heading-2-2">Form fields</h2>
<p>The <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><form></code> tag alone is not enough to create a complete form because the user needs to enter some data. The easiest way is to give a text field where the user can enter information. HTML uses two tags for this:</p>
<ul>
<li><code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><input></code> - a single tag that contains a small amount of information. This can be a phone number, email, date of birth, name, etc</li>
<li><code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><textarea></code> is a paired tag that allows the user to write more text. It can be a comment for an order or a review</li>
</ul>
<h3 id="heading-3-3">textarea</h3>
<p>The simplest tag is <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><textarea></code>. Its job is to create a large text box.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<textarea></textarea>
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<iframe height="265" style="width:100%" scrolling="no" title="css_content_course_forms_textarea" src="https://codepen.io/hexlet/embed/WNGPEjY?height=265&theme-id=light&default-tab=html,result&editable=true" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href='https://codepen.io/hexlet/pen/WNGPEjY'>css_content_course_forms_textarea</a> by Hexlet
(<a href='https://codepen.io/hexlet'>@hexlet</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
<p>In the example, you can see the two attributes of the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><textarea></code> tag: <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">cols</code> and <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">rows</code>. They are responsible for the number of characters and strings that are available inside <em>textarea</em>. If there's more content, then there'll be a scroll bar.</p>
<p>Try resizing the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><textarea></code> element. This can be done by pulling the bottom-right corner. You can do this not only to increase the width but also the height, too.</p>
<p><img style="--image-object-fit:contain;width:auto" class="m_9e117634 mantine-Image-root" src="/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6NzY3MywicHVyIjoiYmxvYl9pZCJ9fQ==--06354fb08f235348d09dd66a5f369ee2d5005e83/resize-textarea.gif" alt="Resizing textarea" loading="lazy"/></p>
<p>This behavior is often detrimental to our design. That's why developers don't allow it in most cases. There are several options here:</p>
<ul>
<li>You can set the height and width of the element using CSS. Then the browser won't let the element be stretched</li>
<li>Use the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">resize</code> property with the value set to <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">none</code>. Use it if your website doesn't support mobile browsers or Internet Explorer. For a complete list of supported browsers, visit the <a style="text-decoration:underline" class="mantine-focus-auto m_849cf0da m_b6d8b162 mantine-Text-root mantine-Anchor-root" data-underline="hover" href="https://caniuse.com/css-resize" rel="noopener noreferrer" target="_blank">Can I Use</a> website</li>
</ul>
<iframe height="265" style="width:100%" scrolling="no" title="css_content_course_forms_textarea-resize" src="https://codepen.io/hexlet/embed/vYXbpGx?height=265&theme-id=light&default-tab=css,result&editable=true" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href='https://codepen.io/hexlet/pen/vYXbpGx'>css_content_course_forms_textarea-resize</a> by Hexlet
(<a href='https://codepen.io/hexlet'>@hexlet</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
<h3 id="heading-3-4">input</h3>
<p>A large group of fields can be created using the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><input></code> tag, the main attribute of which is <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">type</code>. It specifies exactly how the browser should handle the element. It makes no sense to look at each value individually because so much information will quickly be forgotten if it is not used.</p>
<p>In this lesson, we'll look at some of the most popular values for the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">type</code> attribute.</p>
<h3 id="heading-3-5"><code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">type="text"</code></h3>
<p>The simplest kind is <em>input</em>, which allows you to enter any information from the user. This field doesn't have built-in validation, the only exception is removing line breaks before sending data to the server. If you want data with line breaks, use the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><textarea></code> tag.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<input type="text">
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<iframe height="265" style="width:100%" scrolling="no" title="css_content_course_forms_input" src="https://codepen.io/hexlet/embed/xxEMpOw?height=265&theme-id=light&default-tab=html,result&editable=true" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href='https://codepen.io/hexlet/pen/xxEMpOw'>css_content_course_forms_input</a> by Hexlet
(<a href='https://codepen.io/hexlet'>@hexlet</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
<p>Note that now the field is not marked in any way, making it totally unclear what the user needs to enter. The first thing that comes to mind is to add a heading or a paragraph before the field. Yes, this will give the appearance of a field description. But appearance is only one thing! In terms of semantics, there is no connection between the text and the input field. This is critical for users who use screen readers, as they might not realize that the field name and the field itself are connected.</p>
<hr/>
<p>A <strong>screen reader</strong> is a device for reading text from a screen. Used by people who are blind or visually impaired.</p>
<hr/>
<p>To link the field and its name, we use the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><label></code> tag and put text inside it. To link <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><label></code> and <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><input></code>, we can use one of two options. They're interchangeable, so you can use the one that's convenient for your particular situation.</p>
<ul>
<li>Link by identifier. For this purpose, the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><input></code> tag is given a unique <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">id</code>. The <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><label></code> is given the attribute <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">for</code>, whose value is the input's <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">id</code></li>
</ul>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<label for="name">Your name</label>
<input id="name" type="text">
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<ul>
<li>Embedding <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><input></code> inside <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><label></code>. This method means you don't have to give ids, but it can make the styling process a little more complicated</li>
</ul>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<label>Your name
<input type="text">
</label>
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<hr/>
<p><strong>Important</strong>: All elements that users can fill out must have a <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><label></code> tag. These are the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><input></code> and <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><textarea></code> elements. This is true even if there is no visual caption for the field.</p>
<p>You can use the following CSS code to hide the element. As you grow as a developer, you'll get to understand all the rules described in this code. Usually, the used to hide an element is called <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">.sr-only</code>. This element will be invisible to the user, but the screen reader can read it.</p>
<div class="m_5cb1b9c8 mantine-CodeHighlightTabs-root"><div style="--sa-corner-width:0px;--sa-corner-height:0px" class="m_7b14120b mantine-CodeHighlightTabs-filesScrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><div class="m_38d99e51 mantine-CodeHighlightTabs-files"><button class="mantine-focus-auto m_5cac2e62 mantine-CodeHighlightTabs-file m_87cf2631 mantine-UnstyledButton-root" data-active="true" type="button"><span>css</span></button><button class="mantine-focus-auto m_5cac2e62 mantine-CodeHighlightTabs-file m_87cf2631 mantine-UnstyledButton-root" type="button"><span>html</span></button></div></div></div><div data-orientation="horizontal" class="m_c44ba933 mantine-ScrollArea-scrollbar" data-hidden="true" style="position:absolute;--sa-thumb-width:18px" data-mantine-scrollbar="true"></div><div class="m_c44ba933 mantine-ScrollArea-scrollbar" data-hidden="true" data-orientation="vertical" style="position:absolute;--sa-thumb-height:18px" data-mantine-scrollbar="true"></div></div><div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlightTabs-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlightTabs-controls" data-with-offset="true"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlightTabs-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlightTabs-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlightTabs-pre" data-with-offset="true"><code class="m_5caae6d3 mantine-CodeHighlightTabs-code">.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
border: 0;
overflow: hidden;
white-space: nowrap;
}</code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlightTabs-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div></div><hr/>
<h3 id="heading-3-6"><code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">type="radio"</code></h3>
<p>Radio buttons are used to select one option from multiple available ones. Why <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">radio</code>? There is a belief that this type got its name from the first car radios. There were several radio stations available, but only one could be chosen at a time. The meaning here is very similar to that of radio receivers.</p>
<p>In addition to the attributes used in the previous examples, there is another important attribute for radio buttons - <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">name</code>. It's unique to the <em>group</em> of radio buttons.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<h2>Select a radio station</h2>
<div>
<label>
<input type="radio" name="radio-fm" value="87.1 FM">
87.1 FM
</label>
<br>
<label>
<input type="radio" name="radio-fm" value="95.5 FM">
95.5 FM
</label>
<br>
<label>
<input type="radio" name="radio-fm" value="101.4 FM">
101.4 FM
</label>
<br>
<label>
<input type="radio" name="radio-fm" value="103.2 FM">
103.2 FM
</label>
</div>
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<iframe height="348" style="width:100%" scrolling="no" title="css_content_course_forms_input_radio" src="https://codepen.io/hexlet/embed/XWEJwjm?default-tab=html%2Cresult&editable=true&theme-id=light" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href="https://codepen.io/hexlet/pen/XWEJwjm">
css_content_course_forms_input_radio</a> by Hexlet (<a href="https://codepen.io/hexlet">@hexlet</a>)
on <a href="https://codepen.io">CodePen</a>.
</iframe>
<p>In addition to the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">name</code> attribute, radio buttons also use the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">value</code> attribute. Inside it is the value that will be sent to the server.</p>
<h3 id="heading-3-7"><code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">type="checkbox"</code></h3>
<p>Checkboxes are a bit like radio buttons, but have a significant difference - you can select several values at once. Imagine the user is choosing their favorite dishes. It's probably more than one dish. They could use <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><textarea></code>, but checkboxes are preferable.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<h2>Your favorite dishes</h2>
<div>
<label>
<input type="checkbox" name="dishes" value="pizza">
Pizza
</label>
<br>
<label>
<input type="checkbox" name="dishes" value="burger">
Burgers
</label>
<br>
<label>
<input type="checkbox" name="dishes" value="paste">
Pasta
</label>
</div>
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<iframe height="347" style="width:100%" scrolling="no" title="css_content_course_forms_input_checkbox" src="https://codepen.io/hexlet/embed/YzaPbGr?default-tab=html%2Cresult&editable=true&theme-id=light" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href="https://codepen.io/hexlet/pen/YzaPbGr">
css_content_course_forms_input_checkbox</a> by Hexlet (<a href="https://codepen.io/hexlet">@hexlet</a>)
on <a href="https://codepen.io">CodePen</a>.
</iframe>
<h2 id="heading-2-8">Lists</h2>
<p>Lists are separate elements in forms. Imagine a filter on a tech store website. You can only filter items in one category at a time. You can use radio buttons for this, or even checkboxes in the case of multiple choices. But there is another way, you can use a list.</p>
<p>Creating a list is very similar to creating a piece of text that's a list. We use the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><select></code> select tags for this in forms, and its items are found inside <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><option></code> tags.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<h2>Category</h2>
<select name="category">
<option value="computer">PC</option>
<option value="phone" selected>Smartphones</option>
<option value="appliances">Home appliances</option>
</select>
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<iframe height="300" style="width:100%" scrolling="no" title="css_content_course_forms_select" src="https://codepen.io/hexlet/embed/WNzbBGP?default-tab=html%2Cresult&editable=true&theme-id=light" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href="https://codepen.io/hexlet/pen/WNzbBGP">
css_content_course_forms_select</a> by Hexlet (<a href="https://codepen.io/hexlet">@hexlet</a>)
on <a href="https://codepen.io">CodePen</a>.
</iframe>
<p>In the example, there is a new attribute - <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">selected</code>. It's responsible for which item is selected by default. If it's not specified, the first item in the list will be selected.</p>
<p>For radio button and checkbox elements, the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">checked</code> attribute is used by default.</p>
<p>There's another interesting attribute is available for lists, <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">multiple</code>. With it, the list becomes similar to checkboxes and allows you to select several items.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<h2>Category</h2>
<select name="category" multiple>
<option value="computer">PC</option>
<option value="phone" selected>Smartphones</option>
<option value="appliances" selected>Home appliances</option>
</select>
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<iframe height="300" style="width:100%" scrolling="no" title="css_content_course_forms_select_multi" src="https://codepen.io/hexlet/embed/yLKyWam?default-tab=html%2Cresult&editable=true&theme-id=light" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href="https://codepen.io/hexlet/pen/yLKyWam">
css_content_course_forms_select_multi</a> by Hexlet (<a href="https://codepen.io/hexlet">@hexlet</a>)
on <a href="https://codepen.io">CodePen</a>.
</iframe>
<h2 id="heading-2-9">Submittig the form</h2>
<p>In the last section, we looked at the different ways in which the user and the form can interact. But it doesn't make any sense if the form won't be sent. To do this, you need to create an element that will send a form when interacted with.</p>
<p>The form can be sent in one of two ways:</p>
<ul>
<li>Create an <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><input></code> with type <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">submit</code>. In this case, an element will be created in the form of a button with the name specified as the value of the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">value</code> attribute</li>
<li>Using a paired <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><button></code> tag. This method gives your more opportunities because the button can contain any HTML code, which, when clicked, will send the form. This method is very convenient for creating a button that's an icon. Right now, this method is the most popular</li>
</ul>
<iframe height="353" style="width:100%" scrolling="no" title="css_content_course_forms_button" src="https://codepen.io/hexlet/embed/LYdEobW?default-tab=html%2Cresult&editable=true&theme-id=light" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href="https://codepen.io/hexlet/pen/LYdEobW">
css_content_course_forms_button</a> by Hexlet (<a href="https://codepen.io/hexlet">@hexlet</a>)
on <a href="https://codepen.io">CodePen</a>.
</iframe>
<h2 id="heading-2-10">Separating form sections</h2>
<p>Forms that aren't separated into sections are a nightmare for users. Once you get to the middle of the form, you'll have no idea which fields are filled with what. You can separate sections with headers or visually. But browsers provide a special mechanism for dividing sections of the form into logical sections - <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">fieldset</code>. They can be seen as an alternative to the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><section></code> tag, but only for forms. The <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><legend></code> tag is used as the header.</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<fieldset>
<legend>User Data</legend>
<label>
First Name
<input type="text" name="name">
</label>
<br>
<label>
Last Name
<input type="text" name="surname">
</label>
</fieldset>
<fieldset>
<legend>Delivery method</legend>
<label>
Courier
<input type="radio" name="delivery" value="courier">
</label>
<br>
<label>
Pickup
<input type="radio" name="delivery" value="pickup">
</label>
</fieldset>
<button>Order</button>
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<iframe height="521" style="width:100%" scrolling="no" title="css_content_course_forms_fieldset" src="https://codepen.io/hexlet/embed/ExEazZK?default-tab=html%2Cresult&editable=true&theme-id=light" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href="https://codepen.io/hexlet/pen/ExEazZK">
css_content_course_forms_fieldset</a> by Hexlet (<a href="https://codepen.io/hexlet">@hexlet</a>)
on <a href="https://codepen.io">CodePen</a>.
</iframe>
<h2 id="heading-2-11">Text inside a text box</h2>
<p>In all the examples in this lesson, the text fields were originally blank. You've probably often seen that there is text in the field before you click on it, inviting you to enter data or showing the format of the expected input.</p>
<p>The <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">placeholder</code> attribute, whose value is the text that is displayed before you click on it (actually, before <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">focus</code> event).</p>
<div style="margin-bottom:var(--mantine-spacing-lg)" class="m_e597c321 mantine-CodeHighlight-codeHighlight" dir="ltr"><div class="m_be7e9c9c mantine-CodeHighlight-controls"><button style="--ai-bg:transparent;--ai-hover:transparent;--ai-color:inherit;--ai-bd:none" class="mantine-focus-auto mantine-active m_d498bab7 mantine-CodeHighlight-control m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="none" type="button" aria-label="Copy code"><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path><path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"></path></svg></span></button></div><div style="--scrollarea-scrollbar-size:calc(0.25rem * var(--mantine-scale));--sa-corner-width:0px;--sa-corner-height:0px" class="m_f744fd40 mantine-CodeHighlight-scrollarea m_d57069b5 mantine-ScrollArea-root" dir="ltr"><div style="overflow-x:hidden;overflow-y:hidden;overscroll-behavior-inline:none" class="m_c0783ff9 mantine-ScrollArea-viewport" data-scrollbars="xy"><div class="m_b1336c6 mantine-ScrollArea-content"><pre class="m_2c47c4fd mantine-CodeHighlight-pre" style="padding:0"><code class="m_5caae6d3 mantine-CodeHighlight-code"><form>
<fieldset>
<legend>User Data</legend>
<label>
First Name
<input type="text" name="name" placeholder="Enter your first name">
</label>
<br>
<label>
Last Name
<input type="text" name="surname" placeholder="Enter your last name">
</label>
</fieldset>
<button>Submit</button>
</form></code></pre></div></div></div><button class="mantine-focus-auto m_c9378bc2 mantine-CodeHighlight-showCodeButton m_87cf2631 mantine-UnstyledButton-root" data-hidden="true" type="button">Expand code</button></div>
<iframe height="373" style="width:100%" scrolling="no" title="css_content_course_forms_placeholder" src="https://codepen.io/hexlet/embed/RwMNmKx?default-tab=html%2Cresult&editable=true&theme-id=light" frameBorder="no" loading="lazy" allowTransparency="true" allowFullScreen="">
See the Pen <a href="https://codepen.io/hexlet/pen/RwMNmKx">
css_content_course_forms_placeholder</a> by Hexlet (<a href="https://codepen.io/hexlet">@hexlet</a>)
on <a href="https://codepen.io">CodePen</a>.
</iframe>
<hr/>
<p><strong>Important</strong>: <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight">placeholder</code> is not a replacement for the <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><label></code> tag. Think of <em>placeholder</em> as the description of a text field, and <code style="margin-bottom:var(--mantine-spacing-lg)" class="m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight m_e597c321 mantine-CodeHighlight-codeHighlight m_dfe9c588 mantine-InlineCodeHighlight-inlineCodeHighlight"><label></code> as the name of that field.</p>
<hr/></div><div style="margin-block:var(--mantine-spacing-xl)" class=""><h2 style="--title-fw:var(--mantine-h2-font-weight);--title-lh:var(--mantine-h2-line-height);--title-fz:var(--mantine-h2-font-size);margin-bottom:var(--mantine-spacing-md)" class="m_8a5d1357 mantine-Title-root" data-order="2">Recommended programs</h2><style data-mantine-styles="inline">.__m__-_R_2mremqrdub_{--carousel-slide-gap:var(--mantine-spacing-xs);--carousel-slide-size:70%;}@media(min-width: 36em){.__m__-_R_2mremqrdub_{--carousel-slide-gap:var(--mantine-spacing-xl);--carousel-slide-size:50%;}}</style><div style="--carousel-control-size:calc(2.5rem * var(--mantine-scale));--carousel-controls-offset:var(--mantine-spacing-sm);margin-bottom:var(--mantine-spacing-lg);padding-block:var(--mantine-spacing-sm);background:var(--app-color-surface)" class="m_17884d0f mantine-Carousel-root responsiveClassName" data-orientation="horizontal" data-include-gap-in-size="true"><div class="m_39bc3463 mantine-Carousel-controls" data-orientation="horizontal"><button class="mantine-focus-auto m_64f58e10 mantine-Carousel-control m_87cf2631 mantine-UnstyledButton-root" type="button" data-inactive="true" data-type="previous" tabindex="-1"><svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" style="transform:rotate(90deg);width:calc(1rem * var(--mantine-scale));height:calc(1rem * var(--mantine-scale));display:block"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg></button><button class="mantine-focus-auto m_64f58e10 mantine-Carousel-control m_87cf2631 mantine-UnstyledButton-root" type="button" data-inactive="true" data-type="next" tabindex="-1"><svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" style="transform:rotate(-90deg);width:calc(1rem * var(--mantine-scale));height:calc(1rem * var(--mantine-scale));display:block"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg></button></div><div class="m_a2dae653 mantine-Carousel-viewport" data-type="media"><div class="m_fcd81474 mantine-Carousel-container __m__-_R_2mremqrdub_" data-orientation="horizontal"><div class="m_d98df724 mantine-Carousel-slide" data-orientation="horizontal"><div tabindex="0" style="cursor:pointer;height:100%"><a style="text-decoration:none" class="mantine-focus-auto m_849cf0da m_b6d8b162 mantine-Text-root mantine-Anchor-root" data-underline="hover" href="/programs/frontend?promo_name=programs_list&promo_position=course&promo_creative=catalog_card&promo_type=card" target="_blank"><div style="height:100%" class="m_e615b15f mantine-Card-root m_1b7284a3 mantine-Paper-root" data-with-border="true"><div style="--group-gap:calc(0.25rem * var(--mantine-scale));--group-align:center;--group-justify:flex-start;--group-wrap:nowrap" class="m_4081bf90 mantine-Group-root"><span style="font-size:var(--mantine-font-size-sm)" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">10 months</span><span class="mantine-focus-auto m_b6d8b162 mantine-Text-root">·</span><span style="font-size:var(--mantine-font-size-sm)" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">For beginners</span></div><p style="margin-bottom:var(--mantine-spacing-sm);font-size:var(--mantine-font-size-h5);font-weight:bold" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">Frontend Developer</p><p class="mantine-focus-auto m_b6d8b162 mantine-Text-root"></p><div style="margin-top:auto" class=""><div class="m_4451eb3a mantine-Center-root"><img style="opacity:0.8;width:70%" class="m_9e117634 mantine-Image-root mantine-visible-from-xs" src="https://hexlet.io/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MTIzNTMsInB1ciI6ImJsb2JfaWQifX0=--f1948fb0c5a45a6d76671a1a32b8cf6f0b53ee57/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbNDAwLDQwMF0sInNhdmVyIjp7InF1YWxpdHkiOjg1fX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--5b6f46dacd1af664f27558553a58076185091823/Software%20code%20testing-cuate.png" alt="Frontend Developer" loading="eager"/></div><div style="--group-gap:var(--mantine-spacing-md);--group-align:end;--group-justify:space-between;--group-wrap:wrap;margin-top:var(--mantine-spacing-xs)" class="m_4081bf90 mantine-Group-root"><p style="font-size:var(--mantine-font-size-xl)" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">from $49</p><p style="font-size:var(--mantine-font-size-sm)" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">Explore →</p></div></div></div></a></div></div><div class="m_d98df724 mantine-Carousel-slide" data-orientation="horizontal"><div tabindex="0" style="cursor:pointer;height:100%"><a style="text-decoration:none" class="mantine-focus-auto m_849cf0da m_b6d8b162 mantine-Text-root mantine-Anchor-root" data-underline="hover" href="/courses?promo_name=programs_list&promo_position=course&promo_creative=catalog_card&promo_type=card"><div style="height:100%" class="m_e615b15f mantine-Card-root m_1b7284a3 mantine-Paper-root" data-with-border="true"><h2 style="--title-fw:var(--mantine-h2-font-weight);--title-lh:var(--mantine-h2-line-height);--title-fz:var(--mantine-h2-font-size);margin-bottom:var(--mantine-spacing-md);font-size:var(--mantine-font-size-h3)" class="m_8a5d1357 mantine-Title-root" data-order="2" data-responsive="true">Catalog</h2><p style="margin-bottom:auto" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">A complete list of available courses by direction</p><div style="margin-top:auto" class=""><div class="m_4451eb3a mantine-Center-root"><img style="opacity:0.8;width:70%" class="m_9e117634 mantine-Image-root mantine-visible-from-xs" src="/vite/assets/development-BVihs_d5.png" alt="Orientation"/></div></div></div></a></div></div></div></div></div></div></div></div></div><style data-mantine-styles="inline">.__m__-_R_1bdub_{--col-flex-grow:auto;--col-flex-basis:8.333333333333334%;--col-max-width:8.333333333333334%;}@media(min-width: 48em){.__m__-_R_1bdub_{--col-flex-grow:auto;--col-flex-basis:16.666666666666668%;--col-max-width:16.666666666666668%;}}</style><div style="min-width:0rem;height:100%;min-height:0rem" class="m_96bdd299 mantine-Grid-col __m__-_R_1bdub_"><div style="margin-inline:var(--mantine-spacing-xs)" class="mantine-visible-from-sm"><button style="--button-color:var(--mantine-color-white);margin-bottom:var(--mantine-spacing-lg);text-decoration:none" class="mantine-focus-auto m_849cf0da mantine-focus-auto m_77c9d27d mantine-Button-root m_87cf2631 mantine-UnstyledButton-root m_b6d8b162 mantine-Text-root mantine-Anchor-root" data-underline="hover" data-disabled="true" data-block="true" disabled="" type="button"><span class="m_80f1301b mantine-Button-inner"><span class="m_811560b9 mantine-Button-label"><span style="margin-inline-end:var(--mantine-spacing-xs)" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">Next</span>→</span></span></button><a style="padding-inline:0rem" class="mantine-focus-auto m_f0824112 mantine-NavLink-root m_87cf2631 mantine-UnstyledButton-root"><span class="m_690090b5 mantine-NavLink-section" data-position="left"><div style="--ti-size:var(--ti-size-sm);--ti-bg:transparent;--ti-color:var(--mantine-color-indigo-light-color);--ti-bd:calc(0.0625rem * var(--mantine-scale)) solid transparent;color:inherit" class="m_7341320d mantine-ThemeIcon-root" data-variant="transparent" data-size="sm"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-list-numbers "><path d="M11 6h9"></path><path d="M11 12h9"></path><path d="M12 18h8"></path><path d="M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"></path><path d="M6 10v-6l-2 2"></path></svg></div></span><div class="m_f07af9d2 mantine-NavLink-body"><span class="m_1f6ac4c4 mantine-NavLink-label">Navigation</span><span class="m_57492dcc mantine-NavLink-description">Theory</span></div><span class="m_690090b5 mantine-NavLink-section" data-position="right"></span></a><div style="margin-block:var(--mantine-spacing-lg)" class="m_3eebeb36 mantine-Divider-root" data-orientation="horizontal" role="separator"></div><div style="margin-block:var(--mantine-spacing-lg)" class=""><div style="justify-content:space-between;margin-bottom:calc(0.1875rem * var(--mantine-scale));color:var(--mantine-color-dimmed);font-size:var(--mantine-font-size-xs)" class="m_8bffd616 mantine-Flex-root __m__-_R_qimrbdub_"><p style="font-size:var(--mantine-font-size-xs)" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">Completed</p><p style="font-size:var(--mantine-font-size-xs)" class="mantine-focus-auto m_b6d8b162 mantine-Text-root">0 / 17</p></div><div style="--progress-size:var(--progress-size-sm)" class="m_db6d6462 mantine-Progress-root" data-size="sm"><div style="--progress-section-size:0%;--progress-section-color:var(--mantine-color-gray-filled)" class="m_2242eb65 mantine-Progress-section" role="progressbar" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" aria-valuetext="0%"></div></div></div><div style="--toc-bg:var(--mantine-color-blue-light);--toc-color:var(--mantine-color-blue-light-color);--toc-size:var(--mantine-font-size-sm);--toc-radius:var(--mantine-radius-sm);margin-top:var(--mantine-spacing-xl)" class="m_bcaa9990 mantine-TableOfContents-root" data-variant="light" data-size="sm"></div></div><div class="mantine-hidden-from-sm"><div style="--stack-gap:0rem;--stack-align:stretch;--stack-justify:flex-start" class="m_6d731127 mantine-Stack-root"><button style="--button-color:var(--mantine-color-white);margin-bottom:var(--mantine-spacing-xs);padding:0rem;text-decoration:none" class="mantine-focus-auto m_849cf0da mantine-focus-auto m_77c9d27d mantine-Button-root m_87cf2631 mantine-UnstyledButton-root m_b6d8b162 mantine-Text-root mantine-Anchor-root" data-underline="hover" data-disabled="true" data-block="true" disabled="" type="button"><span class="m_80f1301b mantine-Button-inner"><span class="m_811560b9 mantine-Button-label">→</span></span></button><button style="--ai-size:var(--ai-size-sm);--ai-bg:transparent;--ai-hover:var(--mantine-color-indigo-light-hover);--ai-color:var(--mantine-color-indigo-light-color);--ai-bd:calc(0.0625rem * var(--mantine-scale)) solid transparent;padding-block:var(--mantine-spacing-lg);color:inherit;width:100%" class="mantine-focus-auto m_8d3f4000 mantine-ActionIcon-root m_87cf2631 mantine-UnstyledButton-root" data-variant="subtle" data-size="sm" data-disabled="true" type="button" disabled=""><span class="m_8d3afb97 mantine-ActionIcon-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-list-numbers "><path d="M11 6h9"></path><path d="M11 12h9"></path><path d="M12 18h8"></path><path d="M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"></path><path d="M6 10v-6l-2 2"></path></svg></span></button></div></div></div></div></div></div></div>
</main>
<footer class="bg-dark fw-light text-light px-3 py-5">
<div class="row small">
<div class="col-12 col-sm-6 col-md-3">
<div class="h5 mb-3">About Hexlet</div>
<ul class="list-unstyled">
<li>
<a class="nav-link link-light py-1 ps-0" href="/pages/about">About us</a>
</li>
<li>
<span class="nav-link link-light py-1 ps-0 external-link" data-href="https://help.hexlet.io/category/4316" data-target="_blank" role="button">Help</span>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" target="_blank" rel="noopener noreferrer" href="/map">Site Map</a>
</li>
</ul>
</div>
<div class="col-12 col-sm-6 col-md-3">
<div class="h5 fw-normal mb-3">Learn</div>
<ul class="list-unstyled">
<li>
<a class="nav-link link-light py-1 ps-0" href="/courses_backend-development">Backend
</a></li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/courses_devops">DevOps
</a></li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/courses_frontend-development">Frontend
</a></li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/courses_python">Python
</a></li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/courses_testing">Testing
</a></li>
</ul>
</div>
<div class="col-12 col-sm-6 col-md-3">
<div class="h5"><span class="translation_missing" title="translation missing: en.layouts.footer_content.popular_courses_for_beginners">Popular Courses For Beginners</span></div>
<ul class="list-unstyled">
<li>
<a class="nav-link link-light py-1 ps-0" href="/programs/frontend">Frontend Developer</a>
</li>
</ul>
</div>
<div class="col-12 col-sm-6 col-md-3">
<div class="h5"><span class="translation_missing" title="translation missing: en.layouts.footer_content.popular_courses_for_advanced">Popular Courses For Advanced</span></div>
<ul class="list-unstyled">
<li>
<a class="nav-link link-light py-1 ps-0" href="/programs/web-development-free">Fundamentals of Web Development</a>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/programs/js-react-development">React</a>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/programs/css-animation">CSS Animation</a>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/programs/http-api">HTTP API</a>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/programs/layout-designer-positioning">Position CSS</a>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/programs/cli-basics">Command line basics</a>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/programs/git-basics-free">Git fundamentals</a>
</li>
</ul>
</div>
</div>
<hr>
<div class="row">
<div class="col-12 col-sm-4 col-md-2">
<div class="fs-4">
<ul class="list-unstyled d-flex">
<li class="me-3">
<a aria-label="Facebook" target="_blank" class="link-light" rel="noopener noreferrer nofollow" href="https://www.facebook.com/hexlethq"><span class="bi bi-facebook"></span>
</a></li>
<li class="me-3">
<a aria-label="Instagram" target="_blank" class="link-light" rel="noopener noreferrer nofollow" href="https://www.instagram.com/hello_hexlet/"><span class="bi bi-instagram"></span>
</a></li>
<li>
<a aria-label="Twitter" target="_blank" class="link-light" rel="noopener noreferrer nofollow" href="https://twitter.com/Hexlet_IO"><span class="bi bi-twitter-x"></span>
</a></li>
</ul>
</div>
<div class="mb-2 d-flex flex-column">
<a class="link-light text-decoration-none" rel="nofollow" href="mailto:support@hexlet.io">support@hexlet.io</a>
<a class="link-light text-decoration-none py-2" target="_blank" href="https://t.me/hexlet_help_bot">t.me/hexlet_help_bot</a>
</div>
<ul class="list-unstyled d-flex">
<li class="me-3">
<span class="link-light text-decoration-none opacity-50 x-font-size-18 opacity-100 external-link" rel="nofollow" data-href="https://hexlet.io/locale/switch?new_locale=en" data-target="_self" role="button"><span class="my-auto">EN</span>
</span></li>
<li class="me-3">
<span class="link-light text-decoration-none opacity-50 x-font-size-18 external-link" rel="nofollow" data-href="https://ru.hexlet.io/locale/switch?new_locale=ru" data-target="_self" role="button"><span class="my-auto">RU</span>
</span></li>
<li class="me-3">
<span class="link-light text-decoration-none opacity-50 x-font-size-18 external-link" rel="nofollow" data-href="https://kz.hexlet.io/locale/switch?new_locale=kz" data-target="_self" role="button"><span class="my-auto">KZ</span>
</span></li>
</ul>
</div>
<div class="col-12 col-sm-4 col-md-3">
<ul class="list-unstyled fs-4">
<li class="mb-3">
<a class="link-light text-decoration-none" href="tel:%2B7%20717%20272%2076%2070">+7 717 272 76 70</a>
<span class="d-block opacity-50 small">free call</span>
</li>
</ul>
</div>
<div class="col-12 col-sm-4 col-md-3">
<ul class="list-unstyled small">
<li>
<a class="nav-link link-light py-1 ps-0" href="/pages/legal">Legal</a>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/pages/offer"><span class="translation_missing" title="translation missing: en.layouts.footer_content.offer">Offer</span></a>
</li>
<li>
<a class="nav-link link-light py-1 ps-0" href="/pages/contacts"><span class="translation_missing" title="translation missing: en.layouts.footer_content.contacts">Contacts</span></a>
</li>
</ul>
</div>
<div class="col-12 col-sm-12 col-md-4 small">
<div class="mb-2">
<div>TOO "Hexlet"</div>
<div>The Republic of Kazakhstan, Almaty</div>
<div>Auezova St., 14A</div>
<div>BIN 230340043714
</div>
</div>
</div>
</div>
</footer>
<div id="root-assistant-offcanvas"></div>
<script src="/vite/assets/assistant-CIOaBlj-.js" crossorigin="anonymous" type="module"></script><link rel="modulepreload" href="/vite/assets/chunk-DsPFFUou.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/init-0bhwJkNI.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/ErrorFallbackBlock-V3hfk_CP.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/MarkdownBlock-DejNWqwz.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/gon-B-jV56Ol.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/mantine-DOJkeu70.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/shiki-DZwEN4Zo.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/utils-ClTF9s_T.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/routes-mvvEXZQ8.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/lib-CJocDKTE.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/Box-DH3_MBnL.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/notifications.store-Cj65YiRw.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/useIsomorphicEffect-Csl7vw8x.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/lib-DeAQqnBE.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/axios-CN66HKVH.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/classnames-DQgTDFJJ.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/dayjs.min-Bfba02I7.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/debounce-BcxwEZ7X.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/prop-types-DGBR76ns.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/client-CYyKzrjQ.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/react-dom-SJZekO2j.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/useTranslation-bo78L81P.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/compiler-runtime-BhqaZ6vG.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/jsx-runtime-DlXMvSuQ.js" as="script" crossorigin="anonymous">
<link rel="modulepreload" href="/vite/assets/react-CFtMU8gd.js" as="script" crossorigin="anonymous">
<script defer src="https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon='{"version":"2024.11.0","token":"d11015b65d11429ea6b4a2ef37dd7e0b","server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}' crossorigin="anonymous"></script>
</body>
</html>