Главная-Скачать софт-Создание HTML форм. Форма входа и регистрации с помощью HTML5 и CSS3 Бесправие login form html
Создание HTML форм. Форма входа и регистрации с помощью HTML5 и CSS3 Бесправие login form html
Login forms are everywhere on the web. Are you using the social networks? You must go through login form of some sort. Do you have an email? Did you join any forums? Did you try to leave a comment on a WordPress site? To gain access to anything on the internet, the chances are you will have to go through some sort of login process. You will probably have to register first, sign up or leave some information behind. You will have to use some sort of login form to do anything on the internet.
So what do Login Forms have to do with HTML and CSS? They are both the essential parts of the Login Forms.
HTML (HyperText Markup Language) is a standard markup language used to create web pages. HTML elements are building blocks of all websites.
CSS (Cascading Style Sheet) is a language used for describing the look and formatting of a document written in a markup language. Such as HTML!
We use HTML to build a website and CSS to make it look nice. That is what most of the users encounter while browsing the web.
We’ve made a list of 50 free login forms that you can use on your WordPress site, blog, forum or anywhere else. This is a hand-picked list by Colorlib to ensure the highest quality of the forms. Each and every form has been thoroughly tested to ensure no components are missing and source code is available with every download. Of course, you are free to use these forms for personal and commercial purposes, with no need for attribution.
Explore 2.5 Million Digital Assets
including 2019’s Best WordPress Templates
2M+ items from the world’s largest marketplace for HTML5 Templates, Themes & Design Assets. Whether that’s what you need, or you’re just after a few Stock Photos – all of it can be found here at Envato Market.
DOWNLOAD NOW
WordPress Login Customizer
The rest of the list and HTML/CSS powered login forms but here you can see the best login customizer plugin for WordPress. It comes with several defined templates that you can further tweak to match the design of your website. Thats to this plugin you can finally get rid of boring WordPress wp-admin page and create a truly unique experience for yourself and your users.
Download
Creative Login Form
Simple yet creative login form created using HTML5 and CSS3. This form can be used as registration form as well. This is our favorite template on this list thanks to its flexibility and similarity that allows you to create
WordPress version
We did search the internet for cool login forms but it was very difficult to find good looking ones therefore we decided to have our take on them. We would like to present 20 login forms designed and developer by Colorlib team.
Login Form 1 by Colorlib
Simple, creative and vibrant login form with a gradient background. You can use this one for all sorts of intentions, like web, mobile or desktop applications. But do get creative with it if you like.
WordPress version
Login Form 2 by Colorlib
Minimal and sophisticated login form by Colorlib with a gradient button with animation and a logo. Use it, alter it and have it as a nice addition to your already nifty web space.
WordPress version
Login Form 3 by Colorlib
A gorgeous login page with a background image with shadow and a gradient form box with login button hover effect. The only limitation that you have is your imagination, so expand your view and use Login Form 3 to its full potential.
WordPress version
Login Form 4 by Colorlib
Creativity knows no limits and nor does Login Form 4. Here it is, at your disposal, ready and set for you to download it and put it to some good use. Do not worry about the responsiveness either.
WordPress version
Login Form 5 by Colorlib
Gorgeous, clean and modern form with an option to log in with Facebook or Google. All buttons have a nice hove effect that spices up the experience.
WordPress version
Login Form 6 by Colorlib
If your page is already super neat and tidy, a login form should be no different. Here is one that will easily meet your expectations if minimalism is your cup of tea.
WordPress version
Login Form 7 by Colorlib
A form with a three-way option of logging into the account. Either it is Facebook, Twitter or email login they prefer, this is the type of a tool that you need to feature on your page. And if they do not already have an account, you can also link it with your sign up page.
WordPress version
Login Form 8 by Colorlib
Another contemporary, trendy and enticing login form with rounded everything. This one is especially applicable to mobile users due to its currently very popular rounded corners style.
WordPress version
Login Form 9 by Colorlib
If you would like to avoid the white or single-color background, this is the login form page that you should consider. Not only does it support a full image background, but it also comes with a gradient overlay and an option to log in with Facebook or Google.
WordPress version
Login Form 10 by Colorlib
A somewhat complete opposite compared to the previous one is Login Form 10. It almost could not be more minimalistic looking while still having this up-to-the-minute feel to it.
WordPress version
Login Form 11 by Colorlib
With our collection of the best HTML5 and CSS3 login forms, you save yourself time and effort (money, too). Instead of building one from scratch, here is another killer ready-to-use template for you to employ.
WordPress version
Login Form 12 by Colorlib
Image background with a blue shadow overlay, name, image and the must-have form, that’s what’s up with Login Form 12. There is also a cool hover effect on the login button and gives you a chance to link it with your registration form for all new users.
WordPress version
Login Form 13 by Colorlib
A split screen sign up form, where one half is dedicated to an image and the other half to the form. It is a free tool which you can start using this very moment. Just download the layout and go full tilt with it.
WordPress version
Login Form 14 by Colorlib
In this collection, we have a mixture of simplistic and those a tad more complex and advanced login forms. In short, there is something for everyone and Login Form 14 is more on the minimalistic side. But why even complicate with a login form, right? To each their own.
WordPress version
Login Form 15 by Colorlib
While still keeping things to the bare minimum, one cool addition to the Login Form 15 is the image banner just above the form. With this little feature, you can make the experience slightly more engaging.
WordPress version
Login Form 16 by Colorlib
This is a login form with a full-screen image on top of which is placed a form with username and password fields and a gradient button with hover effect. Simple and straightforward.
WordPress version
Login Form 17 by Colorlib
To make it appear more personal, this framed login form template is the best fit for you. It has an image side and a form side but keeps things to the very minimum while still ensuring professionalism.
WordPress version
Login Form 18 by Colorlib
If you like to differentiate yourself and keep things original, do consider using Login Form 18. While some enjoy login pages super basic, the others want to have some additional goodies rocking the layout. And if adding a picture is what you are after, this one is for you.
WordPress version
Login Form 19 by Colorlib
Vibrant, energetic and attention-grabbing, that is what this next login form based on HTML5 and CSS3 is all about. It is also fully responsive and mobile-ready, as well as compatible with all major web browsers.
WordPress version
Login Form 20 by Colorlib
Gradient background, black sign in button with hover effect, username and password fields along with custom text and “Forgot password?” section, yep, that’s all part of Login Form 20. Sounds overwhelming but in reality, far from it.
WordPress version
The form is hidden unless you click on “Login” option. Really great feature for modern websites that want to avoid having a separate page for the login form. You can display the form anywhere on your website with this powerful tool.
Download
A design for a Sign Up form using tabs and floating form labels.
Download
What was initially made to stop people from entering one person’s WordPress site, it became a really popular form due to its simplicity and neat design.
Download
Flat Login – Sign Up Form
Once you click “Click me” button in top-right corner, you will get smooth animation that transforms this Login form to Sign up form.
Download
Login With Self-Contained SCSS Form
This is a form with self-contained SCSS. An extension of CSS that adds power and elegance to the basic language. It allows to use variables, nested rules, mixins, inline imports, and more.
Download
This is actually an animated Login form, with top “Hey you, Login already” transforming into the form at the bottom. Smooth animation effects.
Download
This is an example on how to create a simple login form using HTML5 and CSS3. This form uses pseudo elements (:after and:before) to create the multi page effect. These elements are rotated using the CSS3 transform property. This form uses HTML5 to make validation and submission easy.
Download
Once you enter a wrong password in this form, a nice shake effect will warn you that you did not enter the correct password. A simple and effective solution that will point out the problem of incorrect passwords.
Download
A boxy login form with a little surprise. Try “admin” as a username, and “1234” as a password, for full experience.
Download
Neat little login form. Once you click on “LOGIN” on the left side, animation effect creates neat little login form on the right. Definitely unique approach!
Download
Material Design Form
Fairly simple and easy on the eye login form that you can add to your blog or any other website and spice up the experience. No need to overcomplicate with a simple thing as the login form is. Even if you are just collecting subscribers, you can also play around with this layout and get things rocking.
Download
Bootstrap Snippet Form
Obviously, this next free HTML5 login form is based on the well-liked Bootstrap Framework. This tells you that you can expect some nice flexibility that any modern website and element must practice. Email address, password and a check box to tick if a user would like the platform to remember his or her information. Easy and to the point.
Download
Regardless of your main web design, with things like login forms, you do not want to over complicate it. Instead, you would want to keep it simple and let it to the job, getting users to access their accounts seamlessly. You will achieve that goal with this login form with flat UI unquestionably.
Download
Trendy UI Kits Form
From super simple login forms to those with slightly more action going on. This particular one is pretty similar compared to the last one just that you will notice a frame going all around the form. Get them to type in their names or usernames and passwords and they can enter your world of amazingness.
Download
Dashboard CSS3 HTML5 Form
All the HTML5 and CSS3 login forms you find on this list are simple to use and effortless to attach to your web platform. This one even has a “Forgot your password?” right at the bottom for everyone who just cannot recall their passwords. The template is perfect for entering your dashboard, but you can apply it for other needs, too.
Download
Login With Recovery Form
The title pretty much says it all; this is a neat, clean and minimal looking login form with recovery. What you also notice is that there is no traditional “box” that you are used to seeing login forms use. If you would like to make a difference, you now know which layout to choose.
Download
A free flat login form with a stunning and elegant dark layout coupled with a green call-to-action button. Sure, you can alter the tool to your likings, but you can also employ it exactly as is and have it live on your website in a snap. Play around with its features and have it all set up the way you like it.
Download
Transparent Login
Even a login form can be of super creative and attention-grabbing nature. While many stick to the simple and basic look, there are others who like it special and exclusive. This transparent login form will surely do the trick for you. With an image background and a form over it, this layout can follow your branding to a T.
Download
No need to be really going too in-depth with this next login since it is pretty self-explanatory. It is compatible with the Google Chrome extension, as well as features buttons for those who are not signed up yet or lost their password. If this is the one you were looking for, then scrolling all the way this far was more than worth it.
Download
Elegant Flat Form
A stylish flat form which you can append to your web space as a pop-up or ad as a widget on a page. Whatever the case, it will keep your professional approach intact. It is simple and easy on the eye and also has a CTA for everyone who missed signing up to your members’ area. Use it as is or improve it according to your taste.
Download
Definitely an approach to a free login form that you should not miss. It has a feel of a coupon just that it is not if that even makes any sense. Anyhow, in the text section, you can also link this form to the signup form for those interested in creating an account. Other than that, it surely will capture their attention.
Download
More and more website owners are implementing social logins and you can join the trend as well. This free login form with social integration is the right option to take the plunge. However, along with Twitter, Facebook and Google+ buttons, the layout also features the traditional way of signing up with an email.
Download
If your password is super complex, you sometimes just want to enter it in a “show” mode. Offer this same feature to all your users with the show and hide password login form. It has a stunning dark layout with green details perfect for those who dig this type of designs. Of course, feel free to make changes to it and fine-tune it according to your needs.
Download
Log ‘N Load Animated Form
If you already practice animations and special effects on your page, keep the trend with the login form, too. Instead of creating your own one, you can simply use this striking Log ‘N Load animated form that will do the trick. Once you hover over the login button, the form reveals right in front of you. It even has a circular loading that enhances the experience.
Download
This flat, modern and easy to use login form works great on all devices, mobile, tablet and desktop. You can also play around with different tweaks and alter the default settings to your website’s style precisely. The tool also has cool hover effects that add a touch of sophistication to the overall experience.
DesignMaz have collected list of the best CSS
/HTML Login Form Templates
for Web Designers, Developers that they can download and use to create a form
and most of them also have pre built HTML
validation features as well as some option jQuery validation (like the Login
/Register form
with pass meter below).
Free Responsive Flat Login Form Widget Template
Free Responsive Flat New Login Form Widget Template for your websites. This Login form is designed using web technologies such as . It is completely free for download and can be use for your website or application sign in.
Forms Plus
PopForms
Flat Form with Bootstrap 3
This is a flat modern css3 design based on Booststrap 3 Framework. Responsive design with multi-color multipurpose web forms with pure css3.
Responsive Static Login Form HTML5 Template
Free Responsive Static Login Form HTML5 CSS3 Template. You can download this HTML CSS Sign In Widget which can be used in you web projects.
Free Responsive Flat and Clean Login Form Template
A Responsive Flat and Clean Login Form HTML Template designed using web technologies such as HTML5 and CSS3. You can free download and use for your website or application sign in.
Responsive Flat Purple Login Form Template
A free Responsive Flat Purple Login Form Template built with HTML5, and CSS3. It is completely free for download and can be used straight away in your website or app.
Bootstrap login with social buttons
Any Twitter Bootstrap
developer will love these free Responsive Bootstrap login form template
with social buttons . This Responsive Bootstrap login form template
is a Simple and Clean login form website template
base on Bootstrap 3.1.0 .
Easy to use the beautiful
and colorful css login form
for their own website. Simply insert into the existing CSS
file and enjoy the new CSS login form
. Created with rounded corners and nice look. It degrades nicely on older browsers, e.g. IE7 and IE8.
MetroLogin
is a Windows 8’s Login form
simulator that gives you this ability to make a login page for your website’s users or a login Page for your admin panel with a nice metro design.
Twitter Inspired Login Form – Jquery
This is a drop down login form
similar to the one found on twitter. It comes complete with JavaScript
, CSS
and HTML
. Just like Twitters login
in form
it comes with enhancements like tooltips and a compact login form
and a clicked state button. It uses CSS3
to reduce the need for images and it degrades nicely in non CSS
browsers. It has great browser support and works in most modern browsers and even older ones like Internet explorer 6 and 7.
This is clean and pleasant designed login
& register HTML
user interface with error handling and social buttons.
Clean and usable login
& register form
is for every developer. It’s very fast pure CSS
. Error handling states, social buttons and forgotten password state is in there.
Zi-Popup Login Forms – Pure CSS3
Clean and usable login
& register form
is for every developer. It’s very fast CSS form
with jQuery validation. Error handling, social buttons and forgotten password handling is in there. Bring to live with a jQuery.
Minimalistic Login/Register Form + Live Validation
Minimalistic Designed Login
, Register
and Forgot Template Forms
Pack. Packed with jQuery Live Validation, 7 color styles, 3 different form size options, title animation, custom checkbox, tooltip hints and jQuery Error Handling.
Summer Forms – Login And Registration Forms
Summer Forms
are coupled login
and registration forms
having a set of impressing effects bundled with the bright modern design. The flexibility of these responsive forms
Summer Forms
may be become the first brick of your new web site or may be just a replacement of your old forms
. Every year the people get more exacting. The forms
are well thought out and may satisfy any user.
Not
so long ago, in order to achieve such effects, we used JS. But, now, CSS3
has all the necessary tools for making pop-up windows too.
Moon Forms – Login & Registration CSS Forms
Moon Forms
are coupled login
and registration forms
having a modern design. The flexibility of these responsive forms
allows placing it into any area on your site (like a widget, like a popup window, like a standalone page).
Tab and form
developed by using only CSS3
, no javascript used. It is simple , clean and browser compatible. Very Easy to implement on any kind of website.
Features a large collection of form
styles that are used regularly in websites. You get Search Forms
, Login Forms
, Contact Forms
and General Form
styles. Further all these forms are available in Dark and Light coloured versions, so you get a total of 224 form styles! The login
, contact and general forms
also have focus and validation error styles defined in the css.
Form Framework
that strikes a balance between simplicity and elegance.CSS3 Responsive Forms
kit is simple, clean and fresh modern form
pack develop using bootstrap
.
Day/Night Login Page
Day / Night Login Forms
– has the net and unique design. In the kit you get 2 folder with 6 forms. In two colors white and dark. As in the kit includes 4 style buttons. Thanks to the Day / Night Login Forms
developers can save time and money on developing the design. And the designers can see an example of the correct organization of layers.
Is a set of beautiful form
elements. It has large amount of customized items, different color schemes, responsive
grid system and allows you to create forms
of any complexity and for any needs: login
, registration
, contacts
, review
, order
, comment
, checkout
, etc.
Easy to use HTML5 & CSS3 Login Panel
Golden Forms
is a simple and professional Form
Framework that strikes a balance between simplicity and elegance. The framework is built with pure CSS3
+ HTML5
(no images), features a clean consistent Form UI
, responsive
12 column grid, and can be used to build any kind of Web Forms
quickly whether simple or complex, without special CSS
and coding knowledge.
Your visitors won’t be able to stop themselves contacting you with this baby. The HTML5 AJAX Contact Form
utilises cutting edge HMTL5
code and CSS3
animations to make your contact page elegant and ultra-usable.
– has a clean design and a powerfull 3D Flip Effect
which give user a unique exprince and a fast way to complete the process . In the kit you get 1 psd file with 3 forms styes.
Responsive HTML5 – jQuery Sign In – Registration Form
Responsive HTML5 Sign In
/ Registration form
, with jQuery effects and CSS3
customization.
Как вы уже знаете, веб-клиент имеет возможность передавать веб-серверу различную информацию при помощи GET и POST-запросов. HTML-формы
- это основной инструмент для создания таких запросов. По сути, HTML-форма представляет собой поле или поля для ввода информации на веб-странице. Наглядным примером HTML-формы служит форма ввода логина и пароля для авторизации на сайте.
HTML-форма описывается с помощью парного тега form
. Этот тег имеет два важнейших атрибута: method
и action
. В атрибуте method задается тип HTTP-запроса (get или post), в action - запрашиваемый документ, то есть путь к файлу, запрос которого будет осуществлен. Путь может быть как абсолютным (с указанием домена сайта), так и относительным. Например:
Существует несколько различных видов элементов для ввода данных, которые помещаются внутри формы. Элемент, с которого я хотел бы начать, называется submit
:
<input
type
=
"submit"
value
=
"Войти"
/
>
Элемент представляет собой кнопку, нажатие на которой приводит к выполнению HTTP-запроса. Атрибут value
задает надпись на кнопке. Форма может содержать несколько элементов submit. Чтобы в запрашиваемом документе определить, по какой именно из кнопок было произведено нажатие, необходимо элементам submit установить атрибуты name
. Например:
<form
method
=
"get"
action
=
"/control.php"
>
<input
type
=
"submit"
name
=
"submit"
value
=
"Add"
/
>
<input
type
=
"submit"
name
=
"submit"
value
=
"Edit"
/
>
</
form
>
При формировании запроса веб-браузер включит HTTP-параметр, характеризующий нажатый элемент submit. В качестве имени параметра будет взято значение атрибута name нажатой кнопки, в качестве значения - значение атрибута value. Таким образом, при нажатии кнопки Add будет сформирован запрос:
/control.php?submit=Add
а при нажатии кнопки Edit:
/control.php?submit=Edit
Следующий элемент представляет собой простейший элемент для ввода однострокового текста. Его HTML-код:
<input
type
=
"text"
name
=
"name"
/
>
name - обязательный атрибут для участия в HTTP-запросе. Значение этого атрибута будет использовано в качестве имени HTTP-параметра. Этот атрибут имеется у всех типов элементов форм.
Элементу можно также задать атрибут value, указав в нем текст, который по-умолчанию будет введен в элементе. Например:
<input
type
=
"text"
name
=
"login"
value
=
"Имя пользователя"
/
>
Элемент password
служит для ввода паролей. Внешне он такой же, но введенный текст отображается в виде звездочек или точек:
<input
type
=
"password"
/
>
Этого, в принципе, достаточно для создания простейшей формы авторизации. Давайте попробуем ее реализовать, а затем вернемся к рассмотрению остальных типов элементов.
Создадим файл auth.php в корневом каталоге со следующим содержимым:
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head
>
<title
>
Авторизация</
title
>
<meta
http-equiv
=
"Content-Type"
content
=
"text/html;charset=utf-8"
/
>
</
head
>
<body
>
<form
method
=
"get"
action
=
"/auth.php"
>
<table
>
<tr
>
<td
>
Имя пользователя:</
td
>
<td
>
<input
type
=
"text"
name
=
"login"
value
=
""
/
>
</
td
>
</
tr
>
<tr
>
<td
>
Пароль:</
td
>
<td
>
<input
type
=
"password"
name
=
"pass"
value
=
""
/
>
</
td
>
</
tr
>
</
table
>
<input
type
=
"submit"
value
=
"Войти"
/
>
</
form
>
</
body
>
</
html
>
Как видите, внутри тега form можно размещать теги, помогающие красиво разметить форму (я внутрь поместил таблицу). Форма содержит поля для ввода имени пользователя и пароля с именами login и pass соответственно. При нажатии "Войти" формируется GET-запрос документа /auth.php (то есть, страница запрашивает саму себя). В моем случае полный URL страницы имел вид http://test-domain3/auth.php
.
Введите данные и нажмите "Войти". Страница должна перезагрузиться. Должен также измениться и адрес страницы. В моем случае он принял вид:
Это означает, что документ auth.php был запрошен с GET-параметрами, которые были введены с помощью HTML-формы. Поместите в начало файла auth.php PHP-обработчик, который будет принимать данные для авторизации:
//--Проверяем, были ли переданы данные
if
( isset
($_GET
[
"login"
]
)
&&
isset
($_GET
[
"pass"
]
)
)
{
echo
"Ваше имя пользователя: "
.
$_GET
[
"login"
]
.
", ваш пароль: "
.
$_GET
[
"pass"
]
;
exit
;
}
?>
Если странице были переданы логин и пароль, условие сработает и сообщение будет выведено. Также будет вызван exit
, который прекратит дальнейшее выполнение скрипта, следовательно форма выведена не будет.
Передавать пароль с помощью GET-запроса небезопасно, так как он виден в адресной строке. Сменим тип запроса на POST. Для этого изменим значение атрибута method, а в PHP-обработчике обращения к массиву $_GET изменим на $_POST. Проверьте работоспособность скрипта.
Следующий элемент - флажок
. Его применяют, когда от пользователя необходим ответ вида "да/нет":
<input
type
=
"checkbox"
/
>
Если флажок не отмечен, в параметрах ничего не передается. Иначе передается параметр name со значением on
. Есть еще один момент. Как правило, рядом с флажком присутствует поясняющая надпись. Хорошим тоном является реализация веб-мастером реакции флажка на клики по этой надписи. Делается это просто. Флажку присваивается определенный id, а сама надпись оформляется тегом label
с атрибутом for
, значение которого равно идентификатору флажка:
<input
type
=
"checkbox"
id
=
"remember"
name
=
"remember"
/
>
<label
for
=
"remember"
>
Запомнить меня</
label
>
Похожий элемент используется для выбора ответа из набора значений. Допустим, пользователю необходимо выбрать один из трех цветов:
<input
type
=
"radio"
id
=
"red"
name
=
"color"
value
=
"red"
/
>
<label
for
=
"red"
>
Красный</
label
>
<br
/
>
<input
type
=
"radio"
id
=
"green"
name
=
"color"
value
=
"green"
/
>
<label
for
=
"green"
>
Зеленый</
label
>
<br
/
>
<input
type
=
"radio"
id
=
"blue"
name
=
"color"
value
=
"blue"
/
>
<label
for
=
"blue"
>
Синий</
label
>
<br
/
>
Обратите внимание, что у всех элементов одинаковое значение name. Можно выбрать только одно значение. В HTTP-параметра передастся value выбранного элемента, например color=blue
.
Чтобы изначально был выбран какой-то из элементов, например, первый, ему нужно задать атрибут checked
со значением checked
(стандарт XHTML):
<input
type
=
"radio"
id
=
"red"
name
=
"color"
value
=
"red"
checked
=
"checked"
/
>
Для ввода большого многострочного текста существует специальный элемент textarea
:
<textarea
rows
=
"6"
cols
=
"20"
name
=
"text"
>
Текст внутри элемента</
textarea
>
Текст внутри элемента
Этот элемент, как видите, отличается от предыдущих. Он представляет собой парный тег, а текст помещается не в атрибут, а в тело тега. У элемента также есть атрибут name. При помощи атрибута rows
можно задать количество строк в элементе, cols
- количество символов в строке. Элемент textarea используется, как правило, в POST-формах, т.к. предполагает ввод длинного текста (например, форма сообщения на форуме).
Выпадающий список. Наверняка сталкивались с таким элементом в программах. Позволяет выбрать одно значение из набора. Код элемента также не совсем обычен. Сначала создается элемент-контейнер select
, ему задается атрибут name:
<select
name
=
"towns"
>
</
select
>
Внутрь контейнера помещаются элементы списка. Элемент списка представляет собой парный тег option
, каждому элементу задается атрибут value. В тело элемента прописывается надпись элемента:
<select
name
=
"town"
>
<option
value
=
"msk"
>
Москва</
option
>
<option
value
=
"vlad"
>
Владивосток</
option
>
<option
value
=
"nsk"
>
Новосибирск</
option
>
</
select
>
В HTTP-запросе передается параметр с именем name и значением value выбранного элемента, например town=vlad
. По умолчанию выбран первый элемент списка, если хотите, чтобы был выбран другой элемент, задайте ему атрибут selected
со значением selected
:
Список значений. Если элементу select задать атрибут size
с числовым значением, выпадающий список превратится в список значений. При этом значение атрибута size будет определять вертикальный размер элемента:
<select
name
=
"town"
size
=
"3"
>
<option
value
=
"msk"
>
Москва</
option
>
<option
value
=
"vlad"
>
Владивосток</
option
>
<option
value
=
"nsk"
>
Новосибирск</
option
>
</
select
>
Москва Владивосток Новосибирск
Если элементу select задать атрибут multiple
со значением multiple
(стандарт XHTML), то появится возможность выбирать более одного элемента одновременно (например, с зажатой клавишей Ctrl). В этом случае в HTTP-запросе будут переданы все выбранные элементы с одинаковыми именами, например: town=msk&town=vlad&town=nsk
.
Иногда необходимо в HTTP-запросе передать параметр, который пользователь не должен редактировать, а порой даже и видеть. Допустим, вы реализуете форму редактирования новости. В HTTP-запросе необходимо передавать идентификатор этой новости. Для подобных случаев есть скрытый элемент HTML-форм:
<input
type
=
"hidden"
name
=
"param"
value
=
""
/
>
Этот элемент не будет виден на форме, но при выполнении запроса будет передан HTTP-параметр name=value.
Иногда может пригодиться элемент, очищающий форму. Кнопка, при нажатии на которую все введенные пользователем данные на форме стираются:
<input
type
=
"reset"
value
=
"Очистить"
/
>
Перечисленные элементы имеют два специальных атрибута:
readonly="readonly" - запрещает изменение информации в элементе (режим "только для чтения); disabled="disabled" - делает элемент неактивным.
Существует также элемент для выбора файла, который при сабмите формы будет загружен на веб-сервер, но об этом, пожалуй, в отдельной статье.
HTML формы — сложные элементы интерфейса. Они включают в себя разные функциональные элементы: поля ввода и
Большая часть информации веб-форм передаётся с помощью элемента . Для ввода одной строки текста применяется элемент , для нескольких строк - элемент
Элемент
Last NameLast NameLast Name
Поля формы можно разделять на логические блоки с помощью элемента