Bulma - 选择



说明

当您希望允许用户从多项选择中进行选择时,请使用 Bulma 选择。选择字段支持 3 种类型的修饰符 −

  • 颜色
  • 尺寸
  • 状态

颜色

以下示例描述了通过在选择字段中使用 is-primaryis-infois-successis-warningis-danger 等类来使用颜色修饰符 −

<!DOCTYPE html>
<html>
   <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>Bulma Forms Example</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
      <script src = "https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
   </head>
   
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "title">
               Select Field Colors
            </span>
            <br>
            <br>
            
            <span class = "is-size-5">
               Primary Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-primary">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Info Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-info">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Success Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-success">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Warning Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-warning">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Danger Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-danger">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            
         </div>
      </section>
      
   </body>
</html>

它显示以下输出 −

尺寸

以下示例通过使用诸如选择字段的 is-smallis-mediumis-large 类来描述不同类型的尺寸 −

<!DOCTYPE html>
<html>
   <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>Bulma Forms Example</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
      <script src = "https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
   </head>
   
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "title">
               Select Field Sizes
            </span>
            <br>
            <br>
            
            <span class = "is-size-5">
               Small Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-small">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Normal Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Medium Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-medium">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Large Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-large">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            
         </div>
      </section>
      
   </body>
</html>

它显示以下输出 −

状态

通过使用诸如 is-hoveredis-focusedis-loading 等类以及如下例所述的图标,可以以不同类型状态显示选择字段 −

<!DOCTYPE html>
<html>
   <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>Bulma Forms Example</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
      <script src = "https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
   </head>
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "title">
               Select Field States
            </span>
            <br>
            <br>
            
            <span class = "is-size-5">
               Normal Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Hovered Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select">
                     <select class = "is-hovered">
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Focused Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-medium">
                     <select class = "is-focused">
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            
            <span class = "is-size-5">
               Loading Select 
            </span>
            <div class = "field">
               <div class = "control">
                  <div class = "select is-loading">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
               </div>
            </div>
            <br>
            <br>
            
            <span class = "title">
               Select Field with Icon
            </span>
            <br>
            <br>
            
            <div class = "field">
               <div class = "control has-icons-left">
                  <div class = "select">
                     <select>
                        <option>Option One</option>
                        <option>Option Two</option>
                        <option>Option Three</option>
                     </select>
                  </div>
                  <div class = "icon is-small is-left">
                     <i class = "fas fa-user"></i>
                  </div>
               </div>
            </div>
            
         </div>
      </section>
      
   </body>
</html>

它显示以下输出 −

bulma_form.htm
广告