bootstrap - 同一行 <H> 和 Button

bootstrap - same row <H> and Button

我想在同一行有一个按钮。在 float:left 上,按钮在 float:right 上。所以,一个在一侧,另一个在另一侧的相同位置。

<div class="row">
  <div>
    <h3>Catalogue</h3>
    <div>
      <a href="search.php" class="btn btn-primary"><i class="fa fa-search"></i></a>
    </div>
  </div>
</div>

到目前为止,这是我的代码。我正在使用 bootstrap 3.

这将解决您的查询。

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
</head>
<body>

<div class="container">
  <div class="row">
    <div class="col-sm-6">
      <h3>Catalogue</h3>
    </div>
    <div class="col-sm-6">
      <div class="pull-right">
       <a href="search.php" class="btn btn-primary">Click Me<i class="fa fa-search"></i></a>
      </div>
    </div>
  </div>
</div>

</body>
</html>

这是您要找的吗? ↓↓

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
</head>
<body>

  <div class="container">
    <h3>Catalogue
      <a href="search.php" class="btn btn-primary pull-right">Click Me<i class="fa fa-search"></i></a>
    </h3>
  </div>

</body>
</html>