• \r\n\r\n  用戶名:\r\n  \r\n  賬號:\r\n  \r\n  密碼:\r\n  \r\n  \r\n<\/form>\r\n<\/body>\r\n<\/html><\/pre>

    2. The type attribute of the input element<\/p>

    (1) Single-line text input box <\/p>

    Username: name; Account: value; ID number: maxlength<\/p>

    (2) Password input box<\/p>

    (3)Radio button<\/p>

    (4)Check box<\/p>

    (5)Normal button<\/p>

    (6)Submit button<\/p>

    ( 7) Reset button<\/p>

    (8) Submit button in image form<\/p>

    (9) Hidden field<\/p>

    (10)File field<\/p>

    (11)email type<\/p>

    (12)url type<\/p>

    (13)tel type

    (14)search type<\/p>

    (15)color type<\/p>

    (16)number type<\/p>

    <\/pre>

    (17)range type<\/p>

    (18)Date pickers type<\/p>

    \r\n  ;\r\n  ;\r\n  ;\r\n  ;\r\n  \r\n  \r\n  \r\n<\/form><\/pre>

    3. Other elements<\/p>

    (1)list attribute<\/p>

    \r\n請輸入網(wǎng)址:\r\n\r\n  <\/option>\r\n  <\/option>\r\n  <\/option>\r\n<\/datalist><\/pre>

    <\/p>

    (2)multiple attribute<\/p>

    \r\n電子郵箱:\r\n上傳照片:\r\n\r\n<\/form><\/pre>

    <\/p>

    (3)placeholder attribute<\/p>

    \r\n請輸入郵政編碼:\r\n\r\n<\/form><\/pre>

    <\/p>

    (4) textarea element <\/p>

    \r\n 文本內(nèi)容\r\n<\/textarea><\/pre>

    Example: <\/p>

    \r\n評論:\r\n     \r\n評論的時候,請遵紀守法并注意語言文明。\r\n     <\/textarea>\r\n     \r\n<\/form><\/pre>

    (5) select element <\/p>

    
                    search
                
                    
        
    
    
    	
    	
    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:

    <from action=”url 地址”method=”提交方式”name=”表單名稱”>
         各種表單控件
    </form>

    The following example:

    P212-213
    <!doctype html>
    <html>
    <head>
    <meta charset=”utf-8”>
    <title>創(chuàng)建表單</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>

    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

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

    (17)range type

    (18)Date pickers type

    <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>

    3. Other elements

    (1)list attribute

    <form action=”#”method=”get”>
    請輸入網(wǎng)址:<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>


    (2)multiple attribute

    <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>


    (3)placeholder attribute

    <form actiom=”#”method=”get”>
    請輸入郵政編碼:<input type=”text”name=”code”pattern=”[0-9]{6}”placeholder=”請輸入6位數(shù)的郵政編碼”/>
    <input type=”submit”value=”提交”/>
    </form>


    (4) textarea element

    <textarea cols=”每行中的字符數(shù)”rows=”顯示的行數(shù)“>
     文本內(nèi)容
    </textarea>

    Example:

    <form action=”#”method=”post”>
    評論:<br/>
         <textarea cols=”60”rows=”8”>
    評論的時候,請遵紀守法并注意語言文明。
         </textarea><br/>
         <input type=”submit”value=”提交”/>
    </form>

    (5) select element

    <select>  //<optgroup>
      <option>1</option>
      <option>2</option>
      <option>3</option>
    </select>


    (6) datalist element

    <form action=”#”method=”post”>
    請輸入用戶名:<input type=”text”list=”namelist”/>
    <datalist id=”namelist”>
      <option>admin</option>
      <option>lucy</option>
    </datalist>
    <input type=”submit”value=”提交”/>
    </form>


    (7)keygen element

    <form action=”#”method=”get”>
    請輸入用戶名:<input type=”text”name=”user_name”/><br/>
    請選擇加密強度:<keygen name=”security”/><br/>
    <input type=”submit”value=”提交”/>
    </form>

    Form style

    <!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>

    The above is the application content of html5+css3|form, more For more related content, please pay attention to the PHP Chinese website (www.miracleart.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

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    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.

    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)

    Hot Topics

    PHP Tutorial
    1502
    276
    Handling reconnections and errors with HTML5 Server-Sent Events. Handling reconnections and errors with HTML5 Server-Sent Events. Jul 03, 2025 am 02:28 AM

    When using HTML5SSE, the methods to deal with reconnection and errors include: 1. Understand the default reconnection mechanism. EventSource retrys 3 seconds after the connection is interrupted by default. You can customize the interval through the retry field; 2. Listen to the error event to deal with connection failure or parsing errors, distinguish error types and execute corresponding logic, such as network problems relying on automatic reconnection, server errors manually delay reconnection, and authentication failure refresh token; 3. Actively control the reconnection logic, such as manually closing and rebuilding the connection, setting the maximum number of retry times, combining navigator.onLine to judge network status to optimize the retry strategy. These measures can improve application stability and user experience.

    Integrating CSS and JavaScript effectively with HTML5 structure. Integrating CSS and JavaScript effectively with HTML5 structure. Jul 12, 2025 am 03:01 AM

    HTML5, CSS and JavaScript should be efficiently combined with semantic tags, reasonable loading order and decoupling design. 1. Use HTML5 semantic tags, such as improving structural clarity and maintainability, which is conducive to SEO and barrier-free access; 2. CSS should be placed in, use external files and split by module to avoid inline styles and delayed loading problems; 3. JavaScript is recommended to be introduced in front, and use defer or async to load asynchronously to avoid blocking rendering; 4. Reduce strong dependence between the three, drive behavior through data-* attributes and class name control status, and improve collaboration efficiency through unified naming specifications. These methods can effectively optimize page performance and collaborate with teams.

    Receiving real-time data with HTML5 Server-Sent Events (SSE). Receiving real-time data with HTML5 Server-Sent Events (SSE). Jul 02, 2025 pm 04:46 PM

    Server-SentEvents (SSE) is a lightweight solution provided by HTML5 to push real-time updates to the browser. It realizes one-way communication through long HTTP connections, which is suitable for stock market, notifications and other scenarios. Create EventSource instance and listen for messages when using: consteventSource=newEventSource('/stream'); eventSource.onmessage=function(event){console.log('Received message:',event.data);}; The server needs to set Content-Type to text/event

    Declaring the correct HTML5 doctype for modern pages. Declaring the correct HTML5 doctype for modern pages. Jul 03, 2025 am 02:35 AM

    Doctype is a statement that tells the browser which HTML standard to use to parse the page. Modern web pages only need to be written at the beginning of the HTML file. Its function is to ensure that the browser renders the page in standard mode rather than weird mode, and must be located on the first line, with no spaces or comments in front of it; there is only one correct way to write it, and it is not recommended to use old versions or other variants; other such as charset, viewport, etc. should be placed in part.

    Improving SEO with HTML5 semantic markup and Microdata. Improving SEO with HTML5 semantic markup and Microdata. Jul 03, 2025 am 01:16 AM

    Using HTML5 semantic tags and Microdata can improve SEO because it helps search engines better understand page structure and content meaning. 1. Use HTML5 semantic tags such as,,,, and to clarify the function of page blocks, which helps search engines establish a more accurate page model; 2. Add Microdata structured data to mark specific content, such as article author, release date, product price, etc., so that search engines can identify information types and use them for display of rich media summary; 3. Pay attention to the correct use of tags to avoid confusion, avoid duplicate tags, test the effectiveness of structured data, regularly update to adapt to changes in schema.org, and combine with other SEO means to optimize for long-term.

    Explaining the HTML5 `` vs `` elements. Explaining the HTML5 `` vs `` elements. Jul 12, 2025 am 03:09 AM

    It is a block-level element, suitable for layout; it is an inline element, suitable for wrapping text content. 1. Exclusively occupy a line, width, height and margins can be set, which are often used in structural layout; 2. No line breaks, the size is determined by the content, and is suitable for local text styles or dynamic operations; 3. When choosing, it should be judged based on whether the content needs independent space; 4. It cannot be nested and is not suitable for layout; 5. Priority is given to the use of semantic labels to improve structural clarity and accessibility.

    Getting the user's current location with the HTML5 Geolocation API. Getting the user's current location with the HTML5 Geolocation API. Jul 02, 2025 pm 05:03 PM

    When using HTML5Geolocation API to obtain user location, you must first obtain user authorization, and request and explain the purpose at the right time; the basic method is navigator.geolocation.getCurrentPosition(), which contains successful callbacks, wrong callbacks and configuration parameters; common reasons for failure include permission denied, browser not supported, network problems, etc., alternative solutions and clear prompts should be provided. The specific suggestions are as follows: 1. Request permissions when the user operation is triggered, such as clicking the button; 2. Use enableHighAccuracy, timeout, maximumAge and other parameters to optimize the positioning effect; 3. Error handling should distinguish between different errors

    How to create button elements in HTML forms. How to create button elements in HTML forms. Jul 03, 2025 am 02:39 AM

    Buttons are key interactive elements in HTML forms. There are two main ways to create: 1. Use tags to create custom buttons that support nested content, and the type attribute can be set to submit, reset or button; 2. Use tags to create basic buttons that only display text, suitable for simple scenarios. It is also recommended to combine CSS to set padding, font-size, border-radius and other styles to improve clickability and appearance, and enhance the interactive experience through:hover and:active status. The submission button can also use the disabled attribute to prevent repeated submissions.

    See all articles