99re热视频这里只精品,久久久天堂国产精品女人,国产av一区二区三区,久久久精品成人免费看片,99久久精品免费看国产一区二区三区

Bootstrap5 選擇區(qū)間

2023-07-11 15:14 更新

要設置一個選擇區(qū)間可以在 input 元素中添加 type="range" 并使用 .form-range 類:

選擇區(qū)間:


<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap5 實例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link  rel="external nofollow" target="_blank"  rel="stylesheet">
  <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js" rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ></script>
</head>
<body>

<div class="container mt-3">
  <h2>選擇區(qū)間</h2>
  <p>要設置一個選擇區(qū)間可以在 input 元素中添加 type="range" 并使用 .form-range 類:</p>
  <form action="/action_page.php">
    <label for="customRange" class="form-label">自定義選擇區(qū)間</label>
    <input type="range" class="form-range" id="customRange" name="points">
    <label for="customRange" class="form-label">默認選擇區(qū)間</label>
    <input type="range" id="defaultRange" name="points"><br>
    <button type="submit" class="btn btn-primary mt-3">Submit</button>
  </form>
</div>

</body>
</html>

步長

默認情況下,步長為 1,可以通過 step 屬性來設置:

<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap5 實例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link  rel="external nofollow" target="_blank"  rel="stylesheet">
  <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js" rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ></script>
</head>
<body>

<div class="container mt-3">
  <h2>選擇區(qū)間步長</h2>
  <p>默認情況下,步長為 1,可以通過 step 屬性來設置:</p>
  <form action="/action_page.php">
    <label for="customRange" class="form-label">自定義步長</label>
    <input type="range" class="form-range" step="10">
    <button type="submit" class="btn btn-primary mt-3">Submit</button>
  </form>
</div>

</body>
</html>

最大最小值

默認情況下,最小值為 0,最大值為 100,可以通過 min(最?。?或 max(最大) 屬性來設置:

<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap5 實例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link  rel="external nofollow" target="_blank"  rel="stylesheet">
  <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js" rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ></script>
</head>
<body>

<div class="container mt-3">
  <h2>選擇區(qū)間最大最小值</h2>
  <p>默認情況下,最小值為 0,最大值為 100,可以通過 min(最小) 或 max(最大) 屬性來設置:</p>
  <form action="/action_page.php">
    <label for="customRange" class="form-label">自定義步長</label>
    <input type="range" class="form-range" min="0" max="4">
    <button type="submit" class="btn btn-primary mt-3">Submit</button>
  </form>
</div>

</body>
</html>


以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號