Elementor Header #8

26. Поле для ввода текста

Поле для ввода текста в HTML используется для получения текстовой информации от пользователя. В этом уроке мы рассмотрим основные типы текстовых полей, их атрибуты и применение, а также предложим тестовое задание для закрепления материала.

Основные типы текстовых полей

Текстовое поле <input type="text">

Текстовое поле позволяет пользователю вводить одну строку текста.

				
					<label for="name">Имя:</label>
<input type="text" id="name" name="name">

				
			

Многострочное текстовое поле <textarea>

Текстовая область позволяет вводить многострочный текст.

				
					<label for="message">Сообщение:</label>
<textarea id="message" name="message" rows="4" cols="50"></textarea>

				
			

Поле для ввода пароля <input type="password">

Поле для ввода пароля скрывает введенные символы.

				
					<label for="password">Пароль:</label>
<input type="password" id="password" name="password">

				
			

Поле для ввода email <input type="email">

Поле для ввода email-адреса проверяет правильность введенного адреса.

				
					<label for="email">Email:</label>
<input type="email" id="email" name="email">

				
			

Атрибуты текстовых полей

Общие атрибуты

  • name: имя поля, по которому данные будут отправлены на сервер.
  • value: значение поля по умолчанию.
  • placeholder: текст, который отображается внутри поля до ввода данных пользователем.
  • required: указывает, что поле обязательно для заполнения.
  • readonly: делает поле только для чтения.
  • disabled: отключает поле, делая его недоступным для ввода.

Пример использования атрибутов

				
					<label for="username">Имя пользователя:</label>
<input type="text" id="username" name="username" placeholder="Введите ваше имя" required>

				
			

Примеры использования текстовых полей

Пример 1: Регистрационная форма

				
					<!DOCTYPE html>
<html lang="ru">
<head>
  
  <title>Регистрация</title>
</head>
<body>
  <form action="/register" method="POST">
    <label for="username">Имя пользователя:</label>
    <input type="text" id="username" name="username" placeholder="Введите ваше имя" required><br>

    <label for="password">Пароль:</label>
    <input type="password" id="password" name="password" placeholder="Введите ваш пароль" required><br>

    <label for="email">Email:</label>
    <input type="email" id="email" name="email" placeholder="Введите ваш email" required><br>

    <label for="bio">О себе:</label>
    <textarea id="bio" name="bio" rows="4" cols="50" placeholder="Расскажите о себе"></textarea><br>

    <input type="submit" value="Зарегистрироваться">
  </form>
<script>"use strict";function wprRemoveCPCSS(){var preload_stylesheets=document.querySelectorAll('link[data-rocket-async="style"][rel="preload"]');if(preload_stylesheets&&0<preload_stylesheets.length)for(var stylesheet_index=0;stylesheet_index<preload_stylesheets.length;stylesheet_index++){var media=preload_stylesheets[stylesheet_index].getAttribute("media")||"all";if(window.matchMedia(media).matches)return void setTimeout(wprRemoveCPCSS,200)}var elem=document.getElementById("rocket-critical-css");elem&&"remove"in elem&&elem.remove()}window.addEventListener?window.addEventListener("load",wprRemoveCPCSS):window.attachEvent&&window.attachEvent("onload",wprRemoveCPCSS);</script><script>class RocketElementorAnimation{constructor(){this.deviceMode=document.createElement("span"),this.deviceMode.id="elementor-device-mode-wpr",this.deviceMode.setAttribute("class","elementor-screen-only"),document.body.appendChild(this.deviceMode)}_detectAnimations(){let t=getComputedStyle(this.deviceMode,":after").content.replace(/"/g,"");this.animationSettingKeys=this._listAnimationSettingsKeys(t),document.querySelectorAll(".elementor-invisible[data-settings]").forEach(t=>{const e=t.getBoundingClientRect();if(e.bottom>=0&&e.top<=window.innerHeight)try{this._animateElement(t)}catch(t){}})}_animateElement(t){const e=JSON.parse(t.dataset.settings),i=e._animation_delay||e.animation_delay||0,n=e[this.animationSettingKeys.find(t=>e[t])];if("none"===n)return void t.classList.remove("elementor-invisible");t.classList.remove(n),this.currentAnimation&&t.classList.remove(this.currentAnimation),this.currentAnimation=n;let s=setTimeout(()=>{t.classList.remove("elementor-invisible"),t.classList.add("animated",n),this._removeAnimationSettings(t,e)},i);window.addEventListener("rocket-startLoading",function(){clearTimeout(s)})}_listAnimationSettingsKeys(t="mobile"){const e=[""];switch(t){case"mobile":e.unshift("_mobile");case"tablet":e.unshift("_tablet");case"desktop":e.unshift("_desktop")}const i=[];return["animation","_animation"].forEach(t=>{e.forEach(e=>{i.push(t+e)})}),i}_removeAnimationSettings(t,e){this._listAnimationSettingsKeys().forEach(t=>delete e[t]),t.dataset.settings=JSON.stringify(e)}static run(){const t=new RocketElementorAnimation;requestAnimationFrame(t._detectAnimations.bind(t))}}document.addEventListener("DOMContentLoaded",RocketElementorAnimation.run);</script><noscript><link rel='stylesheet' id='hello-elementor-theme-style-css' href='https://codefor.tech/wp-content/themes/hello-elementor/theme.min.css?ver=3.0.2' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-hello-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/integration/themes/hello-elementor/assets/css/style.css?ver=1724486282' media='all' /><link rel='stylesheet' id='sweetalert2-css' href='https://codefor.tech/wp-content/plugins/user-registration/assets/css/sweetalert2/sweetalert2.min.css?ver=10.16.7' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-general-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-smallscreen-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration-smallscreen.css?ver=1724486282' media='only screen and (max-width: 768px)' /><link data-minify="1" rel='stylesheet' id='user-registration-my-account-layout-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/my-account-layout.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='dashicons-css' href='https://codefor.tech/wp-content/cache/min/1/wp-includes/css/dashicons.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='hello-elementor-css' href='https://codefor.tech/wp-content/themes/hello-elementor/style.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='hello-elementor-header-footer-css' href='https://codefor.tech/wp-content/themes/hello-elementor/header-footer.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='elementor-frontend-css' href='https://codefor.tech/wp-content/plugins/elementor/assets/css/frontend-lite.min.css?ver=3.21.8' media='all' /><link rel='stylesheet' id='elementor-post-6-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-6.css?ver=1718118435' media='all' /><link data-minify="1" rel='stylesheet' id='font-awesome-all-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/all.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='font-awesome-v4-shims-css' href='https://codefor.tech/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/v4-shims.min.css?ver=5.12.0' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-public-styles-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/css/public.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='swiper-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/elementor/assets/lib/swiper/v8/css/swiper.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='elementor-pro-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/frontend-lite.min.css?ver=3.21.3' media='all' /><link rel='stylesheet' id='elementor-global-css' href='https://codefor.tech/wp-content/uploads/elementor/css/global.css?ver=1718118436' media='all' /><link rel='stylesheet' id='elementor-post-1628-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-1628.css?ver=1722908217' media='all' /><link rel='stylesheet' id='elementor-post-8-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-8.css?ver=1719760051' media='all' /><link rel='stylesheet' id='elementor-post-42-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-42.css?ver=1718469014' media='all' /><link rel='stylesheet' id='jquery-chosen-css' href='https://codefor.tech/wp-content/plugins/jet-search/assets/lib/chosen/chosen.min.css?ver=1.8.7' media='all' /><link data-minify="1" rel='stylesheet' id='jet-search-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-search/assets/css/jet-search.css?ver=1724486282' media='all' /><link rel='stylesheet' id='google-fonts-1-css' href='https://fonts.googleapis.com/css?family=Roboto%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CRoboto+Slab%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic&#038;display=swap&#038;subset=cyrillic&#038;ver=6.6.2' media='all' /><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/widget-theme-elements.min.css"><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor/assets/css/widget-icon-list.min.css"><link rel='stylesheet' id='elementor-post-416-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-416.css?ver=1724268811' media='all' /><link rel='stylesheet' id='elementor-post-471-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-471.css?ver=1722847712' media='all' /><link rel='stylesheet' id='prismjs_style-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/modules/code-highlight.min.css?ver=1.23.0' media='' /><link data-minify="1" rel='stylesheet' id='mailpoet_public-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/mailpoet/assets/dist/css/mailpoet-public.c7ad0042.css?ver=1724486282' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_0-css' href='https://fonts.googleapis.com/css?family=Abril+FatFace%3A400%2C400i%2C700%2C700i%7CAlegreya%3A400%2C400i%2C700%2C700i%7CAlegreya+Sans%3A400%2C400i%2C700%2C700i%7CAmatic+SC%3A400%2C400i%2C700%2C700i%7CAnonymous+Pro%3A400%2C400i%2C700%2C700i%7CArchitects+Daughter%3A400%2C400i%2C700%2C700i%7CArchivo%3A400%2C400i%2C700%2C700i%7CArchivo+Narrow%3A400%2C400i%2C700%2C700i%7CAsap%3A400%2C400i%2C700%2C700i%7CBarlow%3A400%2C400i%2C700%2C700i%7CBioRhyme%3A400%2C400i%2C700%2C700i%7CBonbon%3A400%2C400i%2C700%2C700i%7CCabin%3A400%2C400i%2C700%2C700i%7CCairo%3A400%2C400i%2C700%2C700i%7CCardo%3A400%2C400i%2C700%2C700i%7CChivo%3A400%2C400i%2C700%2C700i%7CConcert+One%3A400%2C400i%2C700%2C700i%7CCormorant%3A400%2C400i%2C700%2C700i%7CCrimson+Text%3A400%2C400i%2C700%2C700i%7CEczar%3A400%2C400i%2C700%2C700i%7CExo+2%3A400%2C400i%2C700%2C700i%7CFira+Sans%3A400%2C400i%2C700%2C700i%7CFjalla+One%3A400%2C400i%2C700%2C700i%7CFrank+Ruhl+Libre%3A400%2C400i%2C700%2C700i%7CGreat+Vibes%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_1-css' href='https://fonts.googleapis.com/css?family=Heebo%3A400%2C400i%2C700%2C700i%7CIBM+Plex%3A400%2C400i%2C700%2C700i%7CInconsolata%3A400%2C400i%2C700%2C700i%7CIndie+Flower%3A400%2C400i%2C700%2C700i%7CInknut+Antiqua%3A400%2C400i%2C700%2C700i%7CInter%3A400%2C400i%2C700%2C700i%7CKarla%3A400%2C400i%2C700%2C700i%7CLibre+Baskerville%3A400%2C400i%2C700%2C700i%7CLibre+Franklin%3A400%2C400i%2C700%2C700i%7CMontserrat%3A400%2C400i%2C700%2C700i%7CNeuton%3A400%2C400i%2C700%2C700i%7CNotable%3A400%2C400i%2C700%2C700i%7CNothing+You+Could+Do%3A400%2C400i%2C700%2C700i%7CNoto+Sans%3A400%2C400i%2C700%2C700i%7CNunito%3A400%2C400i%2C700%2C700i%7COld+Standard+TT%3A400%2C400i%2C700%2C700i%7COxygen%3A400%2C400i%2C700%2C700i%7CPacifico%3A400%2C400i%2C700%2C700i%7CPoppins%3A400%2C400i%2C700%2C700i%7CProza+Libre%3A400%2C400i%2C700%2C700i%7CPT+Sans%3A400%2C400i%2C700%2C700i%7CPT+Serif%3A400%2C400i%2C700%2C700i%7CRakkas%3A400%2C400i%2C700%2C700i%7CReenie+Beanie%3A400%2C400i%2C700%2C700i%7CRoboto+Slab%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_2-css' href='https://fonts.googleapis.com/css?family=Ropa+Sans%3A400%2C400i%2C700%2C700i%7CRubik%3A400%2C400i%2C700%2C700i%7CShadows+Into+Light%3A400%2C400i%2C700%2C700i%7CSpace+Mono%3A400%2C400i%2C700%2C700i%7CSpectral%3A400%2C400i%2C700%2C700i%7CSue+Ellen+Francisco%3A400%2C400i%2C700%2C700i%7CTitillium+Web%3A400%2C400i%2C700%2C700i%7CUbuntu%3A400%2C400i%2C700%2C700i%7CVarela%3A400%2C400i%2C700%2C700i%7CVollkorn%3A400%2C400i%2C700%2C700i%7CWork+Sans%3A400%2C400i%2C700%2C700i%7CYatra+One%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='elementor-post-487-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-487.css?ver=1719159596' media='all' /><link rel='stylesheet' id='elementor-post-497-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-497.css?ver=1724485504' media='all' /><link rel='stylesheet' id='elementor-post-503-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-503.css?ver=1718466482' media='all' /><link rel='stylesheet' id='elementor-post-329-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-329.css?ver=1718467092' media='all' /></noscript></body>
</html>

				
			

Пример 2: Форма обратной связи

				
					<!DOCTYPE html>
<html lang="ru">
<head>
  
  <title>Обратная связь</title>
</head>
<body>
  <form action="/feedback" method="POST">
    <label for="name">Имя:</label>
    <input type="text" id="name" name="name" placeholder="Ваше имя" required><br>

    <label for="email">Email:</label>
    <input type="email" id="email" name="email" placeholder="Ваш email" required><br>

    <label for="message">Сообщение:</label>
    <textarea id="message" name="message" rows="4" cols="50" placeholder="Ваше сообщение"></textarea><br>

    <input type="submit" value="Отправить">
  </form>
<noscript><link rel='stylesheet' id='hello-elementor-theme-style-css' href='https://codefor.tech/wp-content/themes/hello-elementor/theme.min.css?ver=3.0.2' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-hello-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/integration/themes/hello-elementor/assets/css/style.css?ver=1724486282' media='all' /><link rel='stylesheet' id='sweetalert2-css' href='https://codefor.tech/wp-content/plugins/user-registration/assets/css/sweetalert2/sweetalert2.min.css?ver=10.16.7' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-general-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-smallscreen-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration-smallscreen.css?ver=1724486282' media='only screen and (max-width: 768px)' /><link data-minify="1" rel='stylesheet' id='user-registration-my-account-layout-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/my-account-layout.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='dashicons-css' href='https://codefor.tech/wp-content/cache/min/1/wp-includes/css/dashicons.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='hello-elementor-css' href='https://codefor.tech/wp-content/themes/hello-elementor/style.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='hello-elementor-header-footer-css' href='https://codefor.tech/wp-content/themes/hello-elementor/header-footer.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='elementor-frontend-css' href='https://codefor.tech/wp-content/plugins/elementor/assets/css/frontend-lite.min.css?ver=3.21.8' media='all' /><link rel='stylesheet' id='elementor-post-6-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-6.css?ver=1718118435' media='all' /><link data-minify="1" rel='stylesheet' id='font-awesome-all-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/all.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='font-awesome-v4-shims-css' href='https://codefor.tech/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/v4-shims.min.css?ver=5.12.0' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-public-styles-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/css/public.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='swiper-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/elementor/assets/lib/swiper/v8/css/swiper.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='elementor-pro-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/frontend-lite.min.css?ver=3.21.3' media='all' /><link rel='stylesheet' id='elementor-global-css' href='https://codefor.tech/wp-content/uploads/elementor/css/global.css?ver=1718118436' media='all' /><link rel='stylesheet' id='elementor-post-1628-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-1628.css?ver=1722908217' media='all' /><link rel='stylesheet' id='elementor-post-8-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-8.css?ver=1719760051' media='all' /><link rel='stylesheet' id='elementor-post-42-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-42.css?ver=1718469014' media='all' /><link rel='stylesheet' id='jquery-chosen-css' href='https://codefor.tech/wp-content/plugins/jet-search/assets/lib/chosen/chosen.min.css?ver=1.8.7' media='all' /><link data-minify="1" rel='stylesheet' id='jet-search-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-search/assets/css/jet-search.css?ver=1724486282' media='all' /><link rel='stylesheet' id='google-fonts-1-css' href='https://fonts.googleapis.com/css?family=Roboto%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CRoboto+Slab%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic&#038;display=swap&#038;subset=cyrillic&#038;ver=6.6.2' media='all' /><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/widget-theme-elements.min.css"><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor/assets/css/widget-icon-list.min.css"><link rel='stylesheet' id='elementor-post-416-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-416.css?ver=1724268811' media='all' /><link rel='stylesheet' id='elementor-post-471-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-471.css?ver=1722847712' media='all' /><link rel='stylesheet' id='prismjs_style-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/modules/code-highlight.min.css?ver=1.23.0' media='' /><link data-minify="1" rel='stylesheet' id='mailpoet_public-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/mailpoet/assets/dist/css/mailpoet-public.c7ad0042.css?ver=1724486282' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_0-css' href='https://fonts.googleapis.com/css?family=Abril+FatFace%3A400%2C400i%2C700%2C700i%7CAlegreya%3A400%2C400i%2C700%2C700i%7CAlegreya+Sans%3A400%2C400i%2C700%2C700i%7CAmatic+SC%3A400%2C400i%2C700%2C700i%7CAnonymous+Pro%3A400%2C400i%2C700%2C700i%7CArchitects+Daughter%3A400%2C400i%2C700%2C700i%7CArchivo%3A400%2C400i%2C700%2C700i%7CArchivo+Narrow%3A400%2C400i%2C700%2C700i%7CAsap%3A400%2C400i%2C700%2C700i%7CBarlow%3A400%2C400i%2C700%2C700i%7CBioRhyme%3A400%2C400i%2C700%2C700i%7CBonbon%3A400%2C400i%2C700%2C700i%7CCabin%3A400%2C400i%2C700%2C700i%7CCairo%3A400%2C400i%2C700%2C700i%7CCardo%3A400%2C400i%2C700%2C700i%7CChivo%3A400%2C400i%2C700%2C700i%7CConcert+One%3A400%2C400i%2C700%2C700i%7CCormorant%3A400%2C400i%2C700%2C700i%7CCrimson+Text%3A400%2C400i%2C700%2C700i%7CEczar%3A400%2C400i%2C700%2C700i%7CExo+2%3A400%2C400i%2C700%2C700i%7CFira+Sans%3A400%2C400i%2C700%2C700i%7CFjalla+One%3A400%2C400i%2C700%2C700i%7CFrank+Ruhl+Libre%3A400%2C400i%2C700%2C700i%7CGreat+Vibes%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_1-css' href='https://fonts.googleapis.com/css?family=Heebo%3A400%2C400i%2C700%2C700i%7CIBM+Plex%3A400%2C400i%2C700%2C700i%7CInconsolata%3A400%2C400i%2C700%2C700i%7CIndie+Flower%3A400%2C400i%2C700%2C700i%7CInknut+Antiqua%3A400%2C400i%2C700%2C700i%7CInter%3A400%2C400i%2C700%2C700i%7CKarla%3A400%2C400i%2C700%2C700i%7CLibre+Baskerville%3A400%2C400i%2C700%2C700i%7CLibre+Franklin%3A400%2C400i%2C700%2C700i%7CMontserrat%3A400%2C400i%2C700%2C700i%7CNeuton%3A400%2C400i%2C700%2C700i%7CNotable%3A400%2C400i%2C700%2C700i%7CNothing+You+Could+Do%3A400%2C400i%2C700%2C700i%7CNoto+Sans%3A400%2C400i%2C700%2C700i%7CNunito%3A400%2C400i%2C700%2C700i%7COld+Standard+TT%3A400%2C400i%2C700%2C700i%7COxygen%3A400%2C400i%2C700%2C700i%7CPacifico%3A400%2C400i%2C700%2C700i%7CPoppins%3A400%2C400i%2C700%2C700i%7CProza+Libre%3A400%2C400i%2C700%2C700i%7CPT+Sans%3A400%2C400i%2C700%2C700i%7CPT+Serif%3A400%2C400i%2C700%2C700i%7CRakkas%3A400%2C400i%2C700%2C700i%7CReenie+Beanie%3A400%2C400i%2C700%2C700i%7CRoboto+Slab%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_2-css' href='https://fonts.googleapis.com/css?family=Ropa+Sans%3A400%2C400i%2C700%2C700i%7CRubik%3A400%2C400i%2C700%2C700i%7CShadows+Into+Light%3A400%2C400i%2C700%2C700i%7CSpace+Mono%3A400%2C400i%2C700%2C700i%7CSpectral%3A400%2C400i%2C700%2C700i%7CSue+Ellen+Francisco%3A400%2C400i%2C700%2C700i%7CTitillium+Web%3A400%2C400i%2C700%2C700i%7CUbuntu%3A400%2C400i%2C700%2C700i%7CVarela%3A400%2C400i%2C700%2C700i%7CVollkorn%3A400%2C400i%2C700%2C700i%7CWork+Sans%3A400%2C400i%2C700%2C700i%7CYatra+One%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='elementor-post-487-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-487.css?ver=1719159596' media='all' /><link rel='stylesheet' id='elementor-post-497-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-497.css?ver=1724485504' media='all' /><link rel='stylesheet' id='elementor-post-503-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-503.css?ver=1718466482' media='all' /><link rel='stylesheet' id='elementor-post-329-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-329.css?ver=1718467092' media='all' /></noscript></body>
</html>

				
			

Распространенные ошибки

1. Отсутствие атрибута name

Без атрибута name данные поля не будут отправлены на сервер.

				
					<!-- Неправильно -->
<input type="text" id="username" placeholder="Введите ваше имя">

<!-- Правильно -->
<input type="text" id="username" name="username" placeholder="Введите ваше имя">

				
			

2. Отсутствие атрибута required для обязательных полей

Если поле обязательно для заполнения, добавьте атрибут required.

				
					<!-- Неправильно -->
<input type="text" id="username" name="username" placeholder="Введите ваше имя">

<!-- Правильно -->
<input type="text" id="username" name="username" placeholder="Введите ваше имя" required>

				
			

Заключение

В этом уроке мы рассмотрели основные типы текстовых полей в HTML, их атрибуты и примеры использования. Текстовые поля играют важную роль в интерактивных веб-приложениях, позволяя пользователям вводить и отправлять данные.

Создайте веб-страницу, которая содержит форму с следующими элементами:

  1. Текстовое поле для имени пользователя.
  2. Парольное поле.
  3. Поле для ввода email.
  4. Многострочное текстовое поле для сообщения.
  5. Кнопку для отправки формы.
				
					<!DOCTYPE html>
<html lang="ru">
<head>
  
  <title>Форма для ввода данных</title>
</head>
<body>
  <form action="/submit" method="POST">
    <label for="username">Имя пользователя:</label>
    <input type="text" id="username" name="username" placeholder="Введите ваше имя" required><br>

    <label for="password">Пароль:</label>
    <input type="password" id="password" name="password" placeholder="Введите ваш пароль" required><br>

    <label for="email">Email:</label>
    <input type="email" id="email" name="email" placeholder="Введите ваш email" required><br>

    <label for="message">Сообщение:</label>
    <textarea id="message" name="message" rows="4" cols="50" placeholder="Ваше сообщение"></textarea><br>

    <input type="submit" value="Отправить">
  </form>
<noscript><link rel='stylesheet' id='hello-elementor-theme-style-css' href='https://codefor.tech/wp-content/themes/hello-elementor/theme.min.css?ver=3.0.2' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-hello-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/integration/themes/hello-elementor/assets/css/style.css?ver=1724486282' media='all' /><link rel='stylesheet' id='sweetalert2-css' href='https://codefor.tech/wp-content/plugins/user-registration/assets/css/sweetalert2/sweetalert2.min.css?ver=10.16.7' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-general-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-smallscreen-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration-smallscreen.css?ver=1724486282' media='only screen and (max-width: 768px)' /><link data-minify="1" rel='stylesheet' id='user-registration-my-account-layout-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/my-account-layout.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='dashicons-css' href='https://codefor.tech/wp-content/cache/min/1/wp-includes/css/dashicons.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='hello-elementor-css' href='https://codefor.tech/wp-content/themes/hello-elementor/style.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='hello-elementor-header-footer-css' href='https://codefor.tech/wp-content/themes/hello-elementor/header-footer.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='elementor-frontend-css' href='https://codefor.tech/wp-content/plugins/elementor/assets/css/frontend-lite.min.css?ver=3.21.8' media='all' /><link rel='stylesheet' id='elementor-post-6-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-6.css?ver=1718118435' media='all' /><link data-minify="1" rel='stylesheet' id='font-awesome-all-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/all.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='font-awesome-v4-shims-css' href='https://codefor.tech/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/v4-shims.min.css?ver=5.12.0' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-public-styles-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/css/public.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='swiper-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/elementor/assets/lib/swiper/v8/css/swiper.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='elementor-pro-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/frontend-lite.min.css?ver=3.21.3' media='all' /><link rel='stylesheet' id='elementor-global-css' href='https://codefor.tech/wp-content/uploads/elementor/css/global.css?ver=1718118436' media='all' /><link rel='stylesheet' id='elementor-post-1628-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-1628.css?ver=1722908217' media='all' /><link rel='stylesheet' id='elementor-post-8-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-8.css?ver=1719760051' media='all' /><link rel='stylesheet' id='elementor-post-42-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-42.css?ver=1718469014' media='all' /><link rel='stylesheet' id='jquery-chosen-css' href='https://codefor.tech/wp-content/plugins/jet-search/assets/lib/chosen/chosen.min.css?ver=1.8.7' media='all' /><link data-minify="1" rel='stylesheet' id='jet-search-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-search/assets/css/jet-search.css?ver=1724486282' media='all' /><link rel='stylesheet' id='google-fonts-1-css' href='https://fonts.googleapis.com/css?family=Roboto%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CRoboto+Slab%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic&#038;display=swap&#038;subset=cyrillic&#038;ver=6.6.2' media='all' /><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/widget-theme-elements.min.css"><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor/assets/css/widget-icon-list.min.css"><link rel='stylesheet' id='elementor-post-416-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-416.css?ver=1724268811' media='all' /><link rel='stylesheet' id='elementor-post-471-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-471.css?ver=1722847712' media='all' /><link rel='stylesheet' id='prismjs_style-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/modules/code-highlight.min.css?ver=1.23.0' media='' /><link data-minify="1" rel='stylesheet' id='mailpoet_public-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/mailpoet/assets/dist/css/mailpoet-public.c7ad0042.css?ver=1724486282' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_0-css' href='https://fonts.googleapis.com/css?family=Abril+FatFace%3A400%2C400i%2C700%2C700i%7CAlegreya%3A400%2C400i%2C700%2C700i%7CAlegreya+Sans%3A400%2C400i%2C700%2C700i%7CAmatic+SC%3A400%2C400i%2C700%2C700i%7CAnonymous+Pro%3A400%2C400i%2C700%2C700i%7CArchitects+Daughter%3A400%2C400i%2C700%2C700i%7CArchivo%3A400%2C400i%2C700%2C700i%7CArchivo+Narrow%3A400%2C400i%2C700%2C700i%7CAsap%3A400%2C400i%2C700%2C700i%7CBarlow%3A400%2C400i%2C700%2C700i%7CBioRhyme%3A400%2C400i%2C700%2C700i%7CBonbon%3A400%2C400i%2C700%2C700i%7CCabin%3A400%2C400i%2C700%2C700i%7CCairo%3A400%2C400i%2C700%2C700i%7CCardo%3A400%2C400i%2C700%2C700i%7CChivo%3A400%2C400i%2C700%2C700i%7CConcert+One%3A400%2C400i%2C700%2C700i%7CCormorant%3A400%2C400i%2C700%2C700i%7CCrimson+Text%3A400%2C400i%2C700%2C700i%7CEczar%3A400%2C400i%2C700%2C700i%7CExo+2%3A400%2C400i%2C700%2C700i%7CFira+Sans%3A400%2C400i%2C700%2C700i%7CFjalla+One%3A400%2C400i%2C700%2C700i%7CFrank+Ruhl+Libre%3A400%2C400i%2C700%2C700i%7CGreat+Vibes%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_1-css' href='https://fonts.googleapis.com/css?family=Heebo%3A400%2C400i%2C700%2C700i%7CIBM+Plex%3A400%2C400i%2C700%2C700i%7CInconsolata%3A400%2C400i%2C700%2C700i%7CIndie+Flower%3A400%2C400i%2C700%2C700i%7CInknut+Antiqua%3A400%2C400i%2C700%2C700i%7CInter%3A400%2C400i%2C700%2C700i%7CKarla%3A400%2C400i%2C700%2C700i%7CLibre+Baskerville%3A400%2C400i%2C700%2C700i%7CLibre+Franklin%3A400%2C400i%2C700%2C700i%7CMontserrat%3A400%2C400i%2C700%2C700i%7CNeuton%3A400%2C400i%2C700%2C700i%7CNotable%3A400%2C400i%2C700%2C700i%7CNothing+You+Could+Do%3A400%2C400i%2C700%2C700i%7CNoto+Sans%3A400%2C400i%2C700%2C700i%7CNunito%3A400%2C400i%2C700%2C700i%7COld+Standard+TT%3A400%2C400i%2C700%2C700i%7COxygen%3A400%2C400i%2C700%2C700i%7CPacifico%3A400%2C400i%2C700%2C700i%7CPoppins%3A400%2C400i%2C700%2C700i%7CProza+Libre%3A400%2C400i%2C700%2C700i%7CPT+Sans%3A400%2C400i%2C700%2C700i%7CPT+Serif%3A400%2C400i%2C700%2C700i%7CRakkas%3A400%2C400i%2C700%2C700i%7CReenie+Beanie%3A400%2C400i%2C700%2C700i%7CRoboto+Slab%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_2-css' href='https://fonts.googleapis.com/css?family=Ropa+Sans%3A400%2C400i%2C700%2C700i%7CRubik%3A400%2C400i%2C700%2C700i%7CShadows+Into+Light%3A400%2C400i%2C700%2C700i%7CSpace+Mono%3A400%2C400i%2C700%2C700i%7CSpectral%3A400%2C400i%2C700%2C700i%7CSue+Ellen+Francisco%3A400%2C400i%2C700%2C700i%7CTitillium+Web%3A400%2C400i%2C700%2C700i%7CUbuntu%3A400%2C400i%2C700%2C700i%7CVarela%3A400%2C400i%2C700%2C700i%7CVollkorn%3A400%2C400i%2C700%2C700i%7CWork+Sans%3A400%2C400i%2C700%2C700i%7CYatra+One%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='elementor-post-487-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-487.css?ver=1719159596' media='all' /><link rel='stylesheet' id='elementor-post-497-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-497.css?ver=1724485504' media='all' /><link rel='stylesheet' id='elementor-post-503-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-503.css?ver=1718466482' media='all' /><link rel='stylesheet' id='elementor-post-329-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-329.css?ver=1718467092' media='all' /></noscript></body>
</html>

				
			

Проверьте свою работу на наличие ошибок и убедитесь, что страница корректно отображается в браузере.

logo