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

  • 相关阅读:
    POJ 3630 Phone List | Trie 树
    POJ 3974 Palindrome | 马拉车模板
    POJ 3422 Kaka's Matrix Travels | 最小费用最大流
    POJ 2195 Going Home | 带权二分图匹配
    POJ 3068 "Shortest" pair of paths | 最小费用最大流
    POJ 3686 The Windy's | 最小费用最大流
    洛谷 最小费用最大流 模板 P3381
    POJ 2987 Firing | 最大权闭合团
    POJ 3469 Dual Core CPU | 最小割
    POJ 3281 Dining | 最大流
  • 原文地址:https://www.cnblogs.com/guojunru/p/5397184.html
Copyright © 2011-2022 走看看