【问题标题】:Which CSS attribute should I move to rewind a button我应该移动哪个 CSS 属性来回退按钮
【发布时间】:2020-09-08 20:53:34
【问题描述】:

我有一个带有时间元素和按钮的表单。我想将按钮移动到底部,但不是底部的最大值。我应该修改哪个 CSS 属性?

<!doctype html>
<html lang="fr">
    
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="Title">
    <link rel="icon" href="ressources/favicon.ico" />
    <title>Title</title>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="ressources/style.css">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <link rel="stylesheet" href="https://getbootstrap.com/docs/4.0/examples/sign-in/signin.css" integrity="sha384-mKB41Eu6sQQvXR8fqvXcVe8SXodkH6cYtVvHkvLwE7Nq0R/+coO4yJispNYKy9iZ" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
  </head>
    
  <body>
    <nav class="navbar navbar-light bg-light text-primary w-100 justify-content-center">
      <div class="row">
        <div class="col-12">
          <a class="navbar-brand">
            TEXT
          </a>
        </div>
      </div>
    </nav>
    
    <center><b><label for="heure">This is a label</label></b></center>
    <center><form method="post" action="myaction.php" role="form" id="formulaire" style="padding: 70px;">
      <input type="time" id="heure" name="heure">
      <button class="btn btn-primary" id="valider" name="valider" type="submit" style="position:absolute;bottom:0;left:40%;"></button>
    </form></center>
  </body>
</html>

【问题讨论】:

  • 导航元素中缺少 div 标签闭包。

标签: html css twitter-bootstrap button


【解决方案1】:

根据您所做的,我只是在 css 中更清楚地将 css 应用于您的按钮并调整中心:

#valider{
  position:absolute;
  bottom: 10%;
  left: 50%;
  transform: translate(-50%);
}
<!doctype html>
<html lang="fr">
    
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="Title">
    <link rel="icon" href="ressources/favicon.ico" />
    <title>Title</title>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="ressources/style.css">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <link rel="stylesheet" href="https://getbootstrap.com/docs/4.0/examples/sign-in/signin.css" integrity="sha384-mKB41Eu6sQQvXR8fqvXcVe8SXodkH6cYtVvHkvLwE7Nq0R/+coO4yJispNYKy9iZ" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
  </head>
    
  <body>
    <nav class="navbar navbar-light bg-light text-primary w-100 justify-content-center">
      <div class="row">
        <div class="col-12">
          <a class="navbar-brand">
            TEXT
          </a>
        </div>
      </div>
    </nav>
    
    <center><b><label for="heure">This is a label</label></b></center>
    <center><form method="post" action="myaction.php" role="form" id="formulaire" style="padding: 70px;">
      <input type="time" id="heure" name="heure">
      <button class="btn btn-primary" id="valider" name="valider" type="submit" style=""></button>
    </form></center>
  </body>
</html>

【讨论】:

    猜你喜欢
    • 2012-08-25
    • 2017-07-22
    • 2010-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-30
    相关资源
    最近更新 更多