这可能是一个非常基本的问题,但我无法解决这个问题: 添加Max-Width媒体查询后,我尝试在一定宽度(714px)的窗口时禁用正文背景图像,但它没有工作。但是,所有其他CSS命令在身体上工作正常,除了禁用背景图像并且只有颜色,这里是下面的代码,任何人都可以帮忙吗?
body {
background-color: #737373;
background-image: url(../Images/bkgd.jpg);
background-size: cover;
color: #3A3A3A;
text-align: left;
font-family: advent-pro;
font-style: normal;
margin: 0px;
font-weight: 400;
font-size: 1.8em;
}
.NavListItem {
float: left;
}
.NavListItem a {
margin: 0px;
text-decoration: none;
display: block;
padding-left: 20px;
color: #232323;
font-size: 1.2em;
padding-top: 20px;
padding-bottom: 20px;
padding-right: 20px;
}
.NavListItem a:hover {
color: black;
background-color: aquamarine;
}
section {
background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(255,255,255,0.92) 49.74%,rgba(255,255,255,0.25) 100%);
background-image: -moz-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(255,255,255,0.92) 49.74%,rgba(255,255,255,0.25) 100%);
background-image: -o-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(255,255,255,0.92) 49.74%,rgba(255,255,255,0.25) 100%);
background-image: linear-gradient(180deg,rgba(255,255,255,1.00) 0%,rgba(255,255,255,0.92) 49.74%,rgba(255,255,255,0.25) 100%);
font-size: 1.5em;
}
.NavBar {
padding: 0px;
margin: 0px;
list-style-type: none;
overflow: hidden;
}
nav {
background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%);
background-image: -moz-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%);
background-image: -o-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%);
background-image: linear-gradient(180deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%);
}
footer {
clear: both;
margin: 0PX;
text-align: center;
position: fixed;
left: 0px;
bottom: 0px;
height: 80px;
width: 100%;
padding-top: 56px;
background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,0.00) 0%,rgba(255,255,255,1.00) 78.24%,rgba(255,255,255,1.00) 100%);
background-image: -moz-linear-gradient(270deg,rgba(255,255,255,0.00) 0%,rgba(255,255,255,1.00) 78.24%,rgba(255,255,255,1.00) 100%);
background-image: -o-linear-gradient(270deg,rgba(255,255,255,0.00) 0%,rgba(255,255,255,1.00) 78.24%,rgba(255,255,255,1.00) 100%);
background-image: linear-gradient(180deg,rgba(255,255,255,0.00) 0%,rgba(255,255,255,1.00) 78.24%,rgba(255,255,255,1.00) 100%);
}
.AsideRight {
width: 55%;
clear: right;
float: right;
border-top-right-radius: 50px;
margin-right: 5%;
margin-left: 1%;
padding-left: 2.5%;
padding-right: 2.5%;
margin-top: 30px;
padding-bottom: 42px;
margin-bottom: 68px;
padding-top: 24px;
}
h1 {
font-size: 3em;
font-family: alfa-slab-one;
font-style: normal;
font-weight: 400;
line-height: 1em;
text-align: center;
color: #EFEFEF;
text-shadow: 2px 2px 10px #353535;
}
h2 {
text-align: center;
font-size: 2.em;
font-family: alfa-slab-one;
font-style: normal;
font-weight: 400;
font-size: 1em;
line-height: 2em;
}
.AsideLeft {
width: 28%;
float: left;
margin-right: 1%;
margin-left: 5%;
padding-bottom: 0px;
}
header {
text-align: center;
margin-top: 20px;
margin-bottom: 30px;
}
.NavList {
padding: 0px;
margin: 0px;
list-style-type: none;
overflow: hidden;
}
.container-fluid .navbar-header .navbar-brand {
font-family: alfa-slab-one;
font-style: normal;
font-weight: 400;
color: #3F3F3F;
}
@media (max-width : 714px ){
.AsideLeft {
width: 90%;
float: none;
margin-right: 5%;
margin-left: 5%;
padding-bottom: 0px;
}
.AsideRight {
width: 90%;
clear: right;
float: none;
border-top-right-radius: 50px;
margin-right: 5%;
margin-left: 5%;
}
h1 {
font-size: 2.2em;
font-family: alfa-slab-one;
font-style: normal;
font-weight: 400;
line-height: 1em;
text-align: center;
color: #EFEFEF;
text-shadow: 2px 2px 10px #353535;
}
body {
background-color: #737373;
/* background-image: url(../Images/bkgd.jpg);
*/ background-size: cover;
color: #3A3A3A;
text-align: left;
font-family: advent-pro;
font-style: normal;
margin: 0px;
font-weight: 400;
font-size: 1.8em;
}
}

<!doctype html>
<html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Website design</title>
<!-- <link href="css/bootstrap.css" rel="stylesheet" type="text/css"> -->
<link href="css/bootstrap-3.3.7.css" rel="stylesheet" type="text/css">
<link href="Css File/styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
body {
background-image: url(Images/Carousel_4.jpg);
}
</style>
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.-->
<script>var __adobewebfontsappname__="dreamweaver"</script>
<script src="http://use.edgefonts.net/actor:n4:default;alfa-slab-one:n4:default;aclonica:n4:default;advent-pro:n4:default.js" type="text/javascript"></script>
<!-- HTML5 shim and Respond.js for 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/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body style="padding-top: 70px">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#topFixedNavbar1" aria-expanded="false"><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="#">Mazen | First Website Design</a></div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="topFixedNavbar1">
<ul class="nav navbar-nav">
<li class="active NavListItem"><a href="#">Home<span class="sr-only">(current)</span></a></li>
<li class="NavListItem"><a href="Portfolio.html">Portfolio</a></li>
<li class="NavListItem"><a href="Contact.html">Contact</a></li>
<li class="NavListItem"><a href="About.html">About </a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<header><img src="Images/Logo.png" width="80" height="80" alt=""/></header>
<aside class="AsideLeft">
<h1>What can i create for you</h1>
</aside>
<section class="AsideRight">
<h2> Creating compelling branding </h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metusloremipsum</p>
</section>
<footer> Copy rights 2017 100% recycled content</footer>
<script src="js/jquery-1.11.3.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<script src="js/bootstrap-3.3.7.js"></script>
</body>
</html>
&#13;
答案 0 :(得分:0)
尝试添加background: none
@media all and (max-width: 712px)
{
background: none;
background-color: #737373;
background-size: cover;
color: #3A3A3A;
text-align: left;
font-family: advent-pro;
font-style: normal;
margin: 0px;
font-weight: 400;
font-size: 1.8em;
}