我目前正在尝试使用 twitter bootstrap 创建一个网站。不幸的是,我无法创建背景图像,以便我的容器推动它。总是将背景推到我的背景图片上。有人可以告诉我该怎么做吗?
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,700);
body {
background: #e5e5e5;
color: #999;
}
header {
background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url(https://static.pexels.com/photos/343299/pexels-photo-343299.jpeg);
background-size: cover;
background-position: center;
height: 100vh; /* 100% of the viewport's height */
background-attachment: fixed;
}
/*#header {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 75px;
z-index: 99999;
}*/
.container {
position:relative
}
.content {
background-color:red;
height: 100%;
min-height: 100vh;
}
.backgroundImage {
width: 100%;
height: auto;
z-index: 1;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #777;
font-weight: 300;
}
a {
color: #52b6ec;
-webkit-transition: 300ms;
-moz-transition: 300ms;
-o-transition: 300ms;
transition: 300ms;
}
.btn {
font-weight: 300;
border: 0;
}
.btn.btn-primary {
background-color: #52b6ec;
}
.btn.btn-primary:hover,
.btn.btn-primary.active {
background-color: #1586c3;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
a:hover,
a:focus {
color: #80c9f1;
text-decoration: none;
outline: none;
}
.box {
padding: 50px 30px;
background: #fff;
border-bottom: 1px solid #e9e9e9;
position: relative;
}
.box.first {
margin-top: -40px;
border-radius: 5px 5px 0 0;
}
.box.last {
border-radius: 0 0 5px 5px;
}
.box h2 {
padding: 10px 30px;
display: inline-block;
border-radius: 4px;
position: relative;
margin-bottom: 30px;
font-size: 48px;
}
/* Start: Recommended Isotope styles */
/**** Isotope Filtering ****/
.isotope-item {
z-index: 2;
}
.isotope-hidden.isotope-item {
pointer-events: none;
z-index: 1;
}
/**** Isotope CSS3 transitions ****/
.isotope,
.isotope .isotope-item {
-webkit-transition-duration: 0.8s;
-moz-transition-duration: 0.8s;
-ms-transition-duration: 0.8s;
-o-transition-duration: 0.8s;
transition-duration: 0.8s;
}
.isotope {
-webkit-transition-property: height, width;
-moz-transition-property: height, width;
-ms-transition-property: height, width;
-o-transition-property: height, width;
transition-property: height, width;
}
.isotope .isotope-item {
-webkit-transition-property: -webkit-transform, opacity;
-moz-transition-property: -moz-transform, opacity;
-ms-transition-property: -ms-transform, opacity;
-o-transition-property: -o-transform, opacity;
transition-property: transform, opacity;
}
/**** disabling Isotope CSS3 transitions ****/
.isotope.no-transition,
.isotope.no-transition .isotope-item,
.isotope .isotope-item.no-transition {
-webkit-transition-duration: 0s;
-moz-transition-duration: 0s;
-ms-transition-duration: 0s;
-o-transition-duration: 0s;
transition-duration: 0s;
}
/* End: Recommended Isotope styles */
/* disable CSS transitions for containers with infinite scrolling*/
.isotope.infinite-scrolling {
-webkit-transition: none;
-moz-transition: none;
-ms-transition: none;
-o-transition: none;
transition: none;
}
#services .box {
padding-bottom: 0;
}
#services .row > div {
margin-bottom: 50px;
}
.center {
text-align: center;
}
#team-scroller .designation {
margin-top: 10px;
display: block;
}
.member {
margin: 0 50px;
text-align: center;
}
.navbar-default {
background: #fff;
border-radius: 0 0 5px 5px;
border: 0;
padding: 0;
-webkit-box-shadow: 0 1px 3px 0 rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 3px 0 rgba(0,0,0,.2);
box-shadow: 0 1px 3px 0 rgba(0,0,0,.2);
overflow: hidden;
}
.navbar-default .first a {
border-radius: 0 0 0 5px;
}
.navbar-default .navbar-brand {
margin-right: 50px;
margin-left: 20px;
width: 200px;
height: 78px;
background: url(../images/logo.png) no-repeat 0 50%;
}
.navbar-default .navbar-nav > li {
margin-left: 1px;
}
.navbar-default .navbar-nav > li > a {
padding: 30px 25px;
font-size: 16px;
line-height: 18px;
color: #000;
}
.navbar-default .navbar-nav > li > a > i {
display: inline-block;
}
.navbar-default .navbar-nav > li.active > a,
.navbar-default .navbar-nav > li.active:focus > a,
.navbar-default .navbar-nav > li.active:hover > a,
.navbar-default .navbar-nav > li:hover > a,
.navbar-default .navbar-nav > li:focus > a,
.navbar-default .navbar-nav > li.active > a:focus,
.navbar-default .navbar-nav > li.active:focus > a:focus,
.navbar-default .navbar-nav > li.active:hover > a:focus,
.navbar-default .navbar-nav > li:hover > a:focus,
.navbar-default .navbar-nav > li:focus > a:focus {
background-color: #999;
color: #fff;
}
.icon-lg {
font-size: 48px;
height: 108px;
width: 108px;
line-height: 108px;
color: #fff;
margin: 10px;
background-color: rgba(0, 0, 0, 0.4);
text-align: center;
display: inline-block !important;
border-radius: 100%;
}
.icon-md {
font-size: 24px;
height: 68px;
width: 68px;
line-height: 68px;
color: #fff;
margin-right: 10px;
background-color: rgba(0, 0, 0, 0.4);
text-align: center;
display: inline-block;
border-radius: 100%;
margin-bottom: 10px;
}
.icon-color1 {
background-color: #e74c3c;
}
.icon-color2 {
background-color: #2ecc71;
}
.icon-color3 {
background-color: #3498db;
}
.icon-color4 {
background-color: #8e44ad;
}
.icon-color5 {
background-color: #1abc9c;
}
.icon-color6 {
background-color: #2c3e50;
}
.gap {
margin-bottom: 50px;
}
.big-gap {
margin-bottom: 100px;
}
#footer {
padding-top: 30px;
padding-bottom: 30px;
color: #999;
}
#footer a {
color: #999;
}
#footer a:hover {
color: #52b6ec;
}
ul.social {
list-style: none;
margin: 10px 0 0;
padding: 0;
}
ul.social > li {
margin: 0 0 20px;
}
ul.social > li > a {
display: block;
font-size: 18px;
}
ul.social > li > a i {
margin-right: 10px;
}
textarea#message {
padding: 10px 15px;
height: 220px;
}
@keyframes scaleUp {
0% {
opacity: 0;
transform: scale(0.3);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@-moz-keyframes scaleUp {
0% {
opacity: 0;
-moz-transform: scale(0.3);
}
100% {
opacity: 1;
-moz-transform: scale(1);
}
}
@-webkit-keyframes scaleUp {
0% {
opacity: 0;
-webkit-transform: scale(0.3);
}
100% {
opacity: 1;
-webkit-transform: scale(1);
}
}
@-ms-keyframes scaleUp {
0% {
opacity: 0;
-ms-transform: scale(0.3);
}
100% {
opacity: 1;
-ms-transform: scale(1);
}
}
@-o-keyframes scaleUp {
0% {
opacity: 0;
-o-transform: scale(0.3);
}
100% {
opacity: 1;
-o-transform: scale(1);
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>example</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="images/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch-icon-57-precomposed.png">
</head><!--/head-->
<body data-spy="scroll" data-target="#navbar" data-offset="0">
<header id="header" role="banner">
<div class="container">
<div id="navbar" class="navbar navbar-default">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="#">example</a></li>
<li><a href="#">example</a></li>
<li><a href="#">example</a></li>
<li><a href="#">example</a></li>
<li><a href="#">example</a></li>
</ul>
</div>
</div>
</div>
</header><!--/#header-->
<section id="services">
<div class="container">
<div class="box first">
<div class="center gap">
<h2>example</h2>
</div><!--/.center-->
<div class="row">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.
Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo
</p>
</div><!--/.row-->
</div><!--/.box-->
</div><!--/.container-->
</section><!--/#services-->
<footer id="footer">
<div class="container">
<div class="row">
<center>
© 2017 <a target="_blank" href="http://example.com" title="example">example</a>. All Rights Reserved.
</center>
</div>
</div>
</footer><!--/#footer-->
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.isotope.min.js"></script>
<script src="js/jquery.prettyPhoto.js"></script>
<script src="js/main.js"></script>
</body>
</html>