我需要一些图片滑块的帮助,由于某些原因,每次我将图像滑块添加到我的网站时,我的代码都不能正常运行它只是不希望按照我希望的方式工作,你可以从代码中看到我希望在标题标签和导航之前添加滑块但是每次添加滑块时它都会因为某种原因不断尝试重叠标题而图像不会显示在滑块上它们会继续显示滑块的一侧有一些未知的原因。
@import url(https://fonts.googleapis.com/css?family=Fira+Sans);
body {
font-family: 'Fira Sans', sans-serif;
font-size: 100%;
}
.atag {
text-decoration: none !important;
}
}
header[role="banner"] #logo-main {
display: block;
}
header {
background-color: red;
}
/*----Nav bar color change----*/
.navbar-default {
background-color: #ff2424;
border-color: #e82c2c;
}
.navbar-default .navbar-brand {
color: #ffffff;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #bdbdbd;
}
.navbar-default .navbar-text {
color: #ffffff;
}
.navbar-default .navbar-nav > li > a {
color: #ffffff;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #bdbdbd;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #bdbdbd;
background-color: #e82c2c;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #bdbdbd;
background-color: #e82c2c;
}
.navbar-default .navbar-toggle {
border-color: #e82c2c;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #e82c2c;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #ffffff;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #ffffff;
}
.navbar-default .navbar-link {
color: #ffffff;
}
.navbar-default .navbar-link:hover {
color: #bdbdbd;
}
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ffffff;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #bdbdbd;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #bdbdbd;
background-color: #e82c2c;
}
}
/*---- End of Nav bar color change----*/
#footer {
background: red;
text-align: center;
color: white;
padding-top: 15px;
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Welcome</title>
<!-- Bootstrap Core CSS CDN -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/layout.css" rel="stylesheet">
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<!-- jQuery Mobile -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css">
<!-- Custom Fonts -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<header class="col-lg-12" role="banner">
<img id="logo-main" src="img/logo.png" width="300" alt="Main Logo">
</header>
<body>
<div>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="img/image1.jpg" style="width:100%" alt="First slide">
<div class="container">
<div class="carousel-caption">
<h1>Slide 1</h1>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a>
</p>
</div>
</div>
</div>
<div class="item">
<img src="http://lorempixel.com/1200/400/people" style="width:100%" data-src="" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>Slide 2</h1>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a>
</p>
</div>
</div>
</div>
<div class="item">
<img src="http://lorempixel.com/1200/400/abstract" style="width:100%" data-src="" alt="Third slide">
<div class="container">
<div class="carousel-caption">
<h1>Slide 3</h1>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a>
</p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a> <a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
<!-- Navigation -->
<nav class="navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header navbar-default">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li class="active">
<a href="index.html">Home</a>
</li>
<li>
<a href="#.html">Buildings</a>
</li>
<li>
<a href="#.html">History</a>
</li>
<li>
<a href="#.html">Businesses</a>
</li>
<li>
<a href="#.html">Location</a>
</li>
<li>
<a href="#.html">People</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
<!-- /.container -->
</nav>
&#13;
答案 0 :(得分:0)
我希望我能正确地回答你的问题,
我为您的<header>
提供了一个高度用于演示目的,并将其放在您的<body>
标记中,您已将其置于其外部。但它现在正在底部进行演示。
<body>
<header class="col-lg-12" role="banner">
<img id="logo-main" src="img/logo.png" width="300" alt="Main Logo">
</header>
<div>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="img/image1.jpg" style="width:100%" alt="First slide">
<div class="container">
<div class="carousel-caption">
<h1>Slide 1</h1>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a>
</p>
</div>
</div>
</div>
<div class="item">
<img src="http://lorempixel.com/1200/400/people" style="width:100%" data-src="" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>Slide 2</h1>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a>
</p>
</div>
</div>
</div>
<div class="item">
<img src="http://lorempixel.com/1200/400/abstract" style="width:100%" data-src="" alt="Third slide">
<div class="container">
<div class="carousel-caption">
<h1>Slide 3</h1>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a>
</p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a> <a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
<!-- Navigation -->
<nav class="navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header navbar-default">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li class="active">
<a href="index.html">Home</a>
</li>
<li>
<a href="#.html">Buildings</a>
</li>
<li>
<a href="#.html">History</a>
</li>
<li>
<a href="#.html">Businesses</a>
</li>
<li>
<a href="#.html">Location</a>
</li>
<li>
<a href="#.html">People</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
<!-- /.container -->
</nav>
CSS:
@import url(https://fonts.googleapis.com/css?family=Fira+Sans);
body {
font-family: 'Fira Sans', sans-serif;
font-size: 100%;
}
.atag {
text-decoration: none !important;
}
header{
height: 30px;
}
/*----Nav bar color change----*/
.navbar-default {
background-color: #ff2424;
border-color: #e82c2c;
}
.navbar-default .navbar-brand {
color: #ffffff;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #bdbdbd;
}
.navbar-default .navbar-text {
color: #ffffff;
}
.navbar-default .navbar-nav > li > a {
color: #ffffff;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #bdbdbd;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #bdbdbd;
background-color: #e82c2c;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #bdbdbd;
background-color: #e82c2c;
}
.navbar-default .navbar-toggle {
border-color: #e82c2c;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #e82c2c;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #ffffff;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #ffffff;
}
.navbar-default .navbar-link {
color: #ffffff;
}
.navbar-default .navbar-link:hover {
color: #bdbdbd;
}
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ffffff;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #bdbdbd;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #bdbdbd;
background-color: #e82c2c;
}
}
/*---- End of Nav bar color change----*/
#footer {
background: red;
text-align: center;
color: white;
padding-top: 15px;
}