zoukankan      html  css  js  c++  java
  • Form Tags

    Fieldset and legend tags

    fieldset: grouping form fields.

    legend: specify a title for each fieldset.

    <form action="#" method="POST">  
        <fieldset>  
            <legend>Contact Info</legend>  
            [...]  
         </fieldset>  
    </form>  
    

    Form field markup and the label and input tags

    For form fields, we have three main tags in HTML: input, select and textarea.

    <div>  
         <label>Name</label>  
        <input type="text" name="name" id="name">  
    </div>


    #Input type radio (and input type checkbox)
       <div>
         <label>Gender</label>
         <label>
           <input type="radio" name="gender" value="m">M</input>
         </label>
         <label>
           <input type="radio" name="gender" value="f">F</input>
        </label>
       </div>
     
    # Input type file
      
    <div>   
        <label for="file">CV</label> 
        <input type="file" name="file" id="file"></input>    
      </div>
    <div>  
        <label for="state">State</label>  
        <select name="state" id="state">  
            <option value="">-- Choose --</option>  
            <option value="">State 1</option>
            <option value="">State 2</option>
        </select>
    </div>
    
    <div>  
        <label for="message">Message</label>  
         <textarea name="message" id="message" cols="30" rows="10"></textarea>  
    </div> 
    

    Creating buttons 

    <button type="submit">Send</button> 
    

    Other attribute:

    placeholder: If you want a field to have a brief explanation of what the user has to type in it, you can use a `placeholder`

    autofoocus: If you want a field to be focused first when the user loads the page, use the boolean attribute `autofocus`

    required: you can determine the required fields in the form

  • 相关阅读:
    click event not triggered on bootstrap modal
    how to use datatables editor
    how to create modals with Bootstrap
    WebSite
    Spring Security OAuth 2开发者指南译
    security和oauth2.0的整合
    Spring Boot遇到的某些问题
    linux主机名莫名其妙变成了bogon,并解决修改为localhost
    Getway网关管理ZUUL
    feign中的hytrix和turbin配置
  • 原文地址:https://www.cnblogs.com/guojunru/p/5397184.html
Copyright © 2011-2022 走看看