【发布时间】:2021-04-22 23:31:29
【问题描述】:
why there is a space at the end of the output? How can i fill the space using bootstrap 4?
.navbar-custom {
background-color:rgb(128 128 128 / 18%);
height:48px;
}
.close{
margin-bottom: 40px;
}
h2{
margin-top: 35px;
margin-left: 34px;
}
/* .logo1{
margin-bottom: 120px;
}
*/
.container-fluid {
max-width: 100%;
padding-right:0;
padding-left:0;
margin-right:0;
margin-left:0
}
<!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/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container-fluid">
<nav class="navbar navbar-custom">
<!-- Brand/logo -->
<a class="navbar-brand" href="#">
<div class="mt-0 ">
<img src="logo.png" class="logo1" alt="logo" style="width:50px;"></div>
</a>
<button type="button" class="close" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</nav>
</div>
<h2>Do you have Fever above 101.4?</h2>
<div class="mx-auto mt-5" style="width:150px">
<img src="fever.png" class="logo1" alt="logo" style="width:200px;">
</div>
<br>
<div class="row row-cols-1">
<div class="col"><button type="button" class="btn btn-primary btn-block mt-5">Yes,I do</button></div>
<div class="col"> <button type="button" class="btn btn-primary btn-block mt-2">No, I don't</button></div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>
如何使用 bootstrap 4 填充空间?我正在处理这个项目并遇到了一个问题,即项目没有完全填充右侧的空间,而不是使用 container-fluid。
【问题讨论】:
-
你能添加你的
head和你的JavaScript(如果有的话)吗?如果我复制您发送的 HTML 并添加 JQuery 和 Bootstrap,按钮会一直到我的屏幕边缘。导航栏一直到container-fluid的边缘,如果你想让它一直到屏幕边缘,你需要把它带到容器外面。例如,在引导站点中,他们使用header标记。
标签: html css bootstrap-4 containers navbar