嗨,我希望链接词的样式应该不一样,而不是像这样。
这就是我所做的。
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
<title>Document</title>
</head>
<body>
<nav class="navbar navbar-expand-sm navbar-light bg-light border-bottom">
<div class="container">
<a class="navbar-brand">Vacation.com</a>
</div>
<button class="navbar-toggler" data-toggler="collapse" data-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a href="#" class="nav-link">Beaches / Resorts</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Sailing</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Contact us</a>
</li>
</ul>
</div>
</nav>
</body>
</html>
如何在Bootstrap中做到这一点?
答案 0 :(得分:1)
在链接上使用text-nowrap
...
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
<title>Document</title>
</head>
<body>
<nav class="navbar navbar-expand-sm navbar-light bg-light border-bottom">
<div class="container">
<a class="navbar-brand">Vacation.com</a>
</div>
<button class="navbar-toggler" data-toggler="collapse" data-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a href="#" class="nav-link text-nowrap">Beaches / Resorts</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link text-nowrap">Sailing</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link text-nowrap">Contact us</a>
</li>
</ul>
</div>
</nav>
</body>
</html>