我在视口顶部有一个固定的导航栏,在它下面有一个包含图像文件的div。它适用于大型设备,但当视口变小时,导航栏和图像文件之间会出现间隙。我无法解决这些问题。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="text/css" href="tex.css" rel="stylesheet">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"><img class="img-responsive" src="images/profile.jpg"></div>
</div>
<nav class="navbar navbar-inverse" style="margin-bottom:0px;">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="#">Home</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
</div>
</nav>
</nav>
</div>
<div class="container-fluid">
<div class="row">
<img class="img-responsive" src="images/imgg.jpg">
</div>
</div>
</body>
</html>
CSS
body{
padding-top:150px;
}