Home Web Front-end H5 Tutorial html5+css3 | form application

html5+css3 | form application

Feb 07, 2017 pm 01:20 PM

1. The basic syntax format for creating a form is as follows:

1

2

3

<from action=”url 地址”method=”提交方式”name=”表单名称”>

     各种表单控件

</form>

Copy after login

The following example:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

P212-213

<!doctype html>

<html>

<head>

<meta charset=”utf-8”>

<title>创建表单</title>

</head>

<body>

<from action=”http://www.mysite.cn/index.asp”method=”post” id=”formBox”autocomplete=”on”>

  用户名:

  <input type=”text”id=”autofirst”name=”autofirst”/><br/><br/>

  账号:

  <input type=”text”name=”zhanghao”/>

  密码:

  <input type=”password”name=”mima”/>

  <input type=”submit”value=”提交”/>

</form>

</body>

</html>

Copy after login

2. The type attribute of the input element

(1) Single-line text input box

Username: name; Account: value; ID number: maxlength

(2) Password input box

(3)Radio button

(4)Check box

(5)Normal button

(6)Submit button

( 7) Reset button

(8) Submit button in image form

(9) Hidden field

(10)File field

(11)email type

(12)url type

(13)tel type

(14)search type

(15)color type

(16)number type

1

<input type=”number”name=”number1”value=”1”min=”1”max=”20”step=”4”/><br/>

Copy after login

(17)range type

(18)Date pickers type

1

2

3

4

5

6

7

8

9

<form action=”#”method=”get”>

  <input type=”date”/>;

  <input type=”month”/>;

  <input type=”week”/>;

  <input type=”time”/>;

  <input type=”datetime”>

  <input type=”datetime-local”/>

  <input type=”submit”value=”提交”/>

</form>

Copy after login

3. Other elements

(1)list attribute

1

2

3

4

5

6

7

<form action=”#”method=”get”>

请输入网址:<input type=”url”list=”url_list”name=”weburl”/>

<datalist id=”url_list”>

  <option label=”新浪”value=”http://www.sina.com.cn”></option>

  <option label=”搜狐”value=”http://www.sohu.com.cn”></option>

  <option label=”传智”value=”http://www.itcast.cn/”></option>

</datalist>

Copy after login


(2)multiple attribute

1

2

3

4

5

<form action=”#”method=”get”>

电子邮箱:<input type=”email”name=”myemail”multiple=”true”/>

上传照片:<input type=”file”name=”selfile”multiple=”true”/><br/><br/>

<input type=”submit”value=”提交“/>

</form>

Copy after login


(3)placeholder attribute

1

2

3

4

<form actiom=”#”method=”get”>

请输入邮政编码:<input type=”text”name=”code”pattern=”[0-9]{6}”placeholder=”请输入6位数的邮政编码”/>

<input type=”submit”value=”提交”/>

</form>

Copy after login


(4) textarea element

1

2

3

<textarea cols=”每行中的字符数”rows=”显示的行数“>

 文本内容

</textarea>

Copy after login

Example:

1

2

3

4

5

6

7

<form action=”#”method=”post”>

评论:<br/>

     <textarea cols=”60”rows=”8”>

评论的时候,请遵纪守法并注意语言文明。

     </textarea><br/>

     <input type=”submit”value=”提交”/>

</form>

Copy after login

(5) select element

1

2

3

4

5

<select>  //<optgroup>

  <option>1</option>

  <option>2</option>

  <option>3</option>

</select>

Copy after login


(6) datalist element

1

2

3

4

5

6

7

8

<form action=”#”method=”post”>

请输入用户名:<input type=”text”list=”namelist”/>

<datalist id=”namelist”>

  <option>admin</option>

  <option>lucy</option>

</datalist>

<input type=”submit”value=”提交”/>

</form>

Copy after login


(7)keygen element

1

2

3

4

5

<form action=”#”method=”get”>

请输入用户名:<input type=”text”name=”user_name”/><br/>

请选择加密强度:<keygen name=”security”/><br/>

<input type=”submit”value=”提交”/>

</form>

Copy after login

Form style

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

<!doctype html>

<html><head>

<meta charset="utf-8">

<title>CSS控制表单样式</title>

  

<style type="text/css">

body{ font-size:12px; font-family:"宋体";}

body,form,input,p{ padding:0; margin:0; border:0;}

form{

              width:320px;

              height:150px;

              padding-top:20px;

              margin:50px auto;

              background:#f5f8fd;

              border-radius:20px;

              border:3px solid #4faccb;

}

p{

              margin-top:15px;

              text-align:center;

}

p span{

              width:40px;

              display:inline-block;

              text-align:right;

}

.num,.pass{

              width:152px;

              height:18px;

              border:1px solid #38a1bf;

    padding:2px 2px 2px 22px;

}

.num{

               background:url(images/1.jpg) no-repeat 5px center #FFF;

               color:#999;

}

.pass{

               background:url(images/2.jpg) no-repeat 5px center #FFF;

}

.btn01,.btn02{

              width:60px;

              height:25px;

              border-radius:3px;

              border:1px solid #6b5d50;

              margin-left:30px;

}

.btn01{ background:#3bb7ea;}

.btn02{ background:#fb8c16;}

</style>

  

<link rel="stylesheet" href="Untitled-1.css" type="text/css">

</head>

<body>

<form action="#" method="post">             

     <p>

    登录:<input type="tel" name="telphone" pattern="^\d{11}$" required/>

     </p>

      <p>

    密码:<input type="tel" name="telphone" pattern="^\d{11}$" required/>

    </p>

    <p>

        <input type="button" class="btn01" value="登录"/>

        <input type="button" class="btn02" value="注册"/>

   </p>

</form>

</body>

</html>

Copy after login

The above is the application content of html5+css3|form, more For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles