我如何以公司的标语线为中心?另外,如何将底部导航栏居中?

时间:2018-06-22 16:04:58

标签: html css twitter-bootstrap bootstrap-4

我是新来的。因此,请介意我问一些愚蠢的问题,因为我刚刚开始研究HTML,CSS和BootStrap。

我正在使用Bootstrap4。如何在公司的标语行中居中?另外,如何将底部导航栏选项居中?

我已经添加了我在Bootstrap CSS文件中所做的修改,其余都是原始的。

 @import url('https://fonts.googleapis.com/css?family=Monoton');
 @import url('https://fonts.googleapis.com/css?family=Cookie');

.tag-line{
  font-family: 'Cookie', cursive;
  font-size: 1.85rem;
  color: white;
  margin-left: 10rem;
  /*float: right;*/
  /*display: inline-block;*/
  /*width: 100%;*/
}

.bg-primary {
  /*background-color: #007bff !important;*/
  background: linear-gradient(to right,#00c6ff,#0072ff);
}

.navbar-menu-config {
  text-align: center;
  font-weight: bolder;
  font-size: 1.3rem;
  float: right;
  /*text-align: center;*/
}
.navbar-brand {
  /*display: inline-block;*/
  /*padding-top: 0.3125rem;*/
  /*padding-bottom: 0.3125rem;*/
  /*margin-right: 1rem;*/
  font-size: 1.85rem;
  line-height: inherit;
  white-space: nowrap;
  font-family: 'Monoton', cursive;
  letter-spacing: 0.1rem;
  word-spacing: 0.2rem;
}
<!DOCTYPE html>
<html>
<head>
	<title>The Tech Tunnel</title>
	<link rel="stylesheet" type="text/css" href="home.css">
</head>
<body>
	<!-- <script src="bootstrap.js"></script> -->
	<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
	<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
	
	<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
		<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
	    <span class="navbar-toggler-icon"></span>
	  	</button>
	  	<a class="navbar-brand" href="#">The Tech Tunnel</a>
	  	<div class="tag-line">Your Passage to everything in the Tech World</div>
	  	<form class="form-inline my-2 my-lg-0">
	      <input class="form-control mr-sm-2" type="search" placeholder="Search..." aria-label="Search">
	      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
	  	</form>
	</nav>

	<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
	    <div class="collapse navbar-collapse navbar-menu-config" id="navbarSupportedContent">
	    <ul class="navbar-nav mr-auto">
	      <li class="nav-item active">
	        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
	      </li>
	      <li class="nav-item">
	        <a class="nav-link" href="#">News</a>
	      </li>
	      <li class="nav-item dropdown">
	        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Shop</a>
	        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
	          <a class="dropdown-item" href="#">Smartphones</a>
	          <a class="dropdown-item" href="#">PC Components</a>
	          <div class="dropdown-divider"></div>
	          <a class="dropdown-item" href="#">Accessories</a>
	        </div>
	      </li>
	      <li class="nav-item">
	        <a class="nav-link" href="#">About Us</a>
	      </li>
	    </ul>
	    
	  </div>
	
</body>
</html>

0 个答案:

没有答案