我尝试让我的图片完全占据Jumbotron,但不幸的是我仍然不知道哪里做错了,你能帮我检查一下吗?似乎图片被切割了,看起来不太好:
现在的样子如何:
Jumbotron所在的代码(在末尾):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My Logo</title>
<meta name="description" content="Wiredwiki App">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
</head>
<style>
body{
padding-top: 40px;
}
</style>
<body data-spy="scroll" data-target="#my-navbar">
<!-- Navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top" id="my-navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="" class="navbar-brand">My logo</a>
</div><!-- Navbar Header-->
<div class="collapse navbar-collapse" id="navbar-collapse">
<!--<a href="" class="btn btn-warning navbar-btn navbar-right">Download Now</a>-->
<ul class="nav navbar-nav">
<li><a href="#feedback">Feedback</a>
<li><a href="#gallery">Gallery</a>
<li><a href="#features">Features</a>
<li><a href="#faq">Faq</a>
<li><a href="#contact">ContactUs</a>
</ul>
</div>
</div><!-- End Container-->
</nav><!-- End navbar -->
<!-- jumbotron-->
<div class="jumbotron">
<div class="container">
</div><!-- End container -->
</div><!-- End jumbotron-->
以下是我尝试实现的自定义.css文件:
.jumbotron
{
position: relative;
background: #000 url("1.png") center center;
width: 100%;
height: 100%;
background-size: cover;
overflow: hidden;
}
根据 @potatopeelings 的更改,它看起来像这样:
![输入图像描述](https://istack.dev59.com/s6Udf.webp)
![输入图像描述](https://istack.dev59.com/gtQcL.webp)