2017-03-02 71 views
0

这可能是一个非常基本的问题,但我不能解决它: 添加最大宽度媒体查询后,我试图禁用正文背景 - 图像时,窗口在一定的宽度(714px),但它没有工作。然而,除禁用背景图像和只有一种颜色外,所有其他CSS命令都可以正常工作,下面是代码,任何人都可以提供帮助吗?添加最大宽度媒体查询后,背景图像不会消失

body { 
 
\t background-color: #737373; 
 
\t background-image: url(../Images/bkgd.jpg); 
 
\t background-size: cover; 
 
\t color: #3A3A3A; 
 
\t text-align: left; 
 
\t font-family: advent-pro; 
 
\t font-style: normal; 
 
\t margin: 0px; 
 
\t font-weight: 400; 
 
\t font-size: 1.8em; 
 
} 
 
.NavListItem { 
 
\t float: left; 
 
} 
 
.NavListItem a { 
 
\t margin: 0px; 
 
\t text-decoration: none; 
 
\t display: block; 
 
\t padding-left: 20px; 
 
\t color: #232323; 
 
\t font-size: 1.2em; 
 
\t padding-top: 20px; 
 
\t padding-bottom: 20px; 
 
\t padding-right: 20px; 
 
} 
 
.NavListItem a:hover { 
 
\t color: black; 
 
\t background-color: aquamarine; 
 
} 
 

 

 
section { 
 
\t 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%); 
 
\t 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%); 
 
\t 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%); 
 
\t 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%); 
 
\t font-size: 1.5em; 
 
} 
 
.NavBar { 
 
\t padding: 0px; 
 
\t margin: 0px; 
 
\t list-style-type: none; 
 
\t overflow: hidden; 
 
} 
 
nav { 
 
\t background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%); 
 
\t background-image: -moz-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%); 
 
\t background-image: -o-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%); 
 
\t background-image: linear-gradient(180deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%); 
 
} 
 

 

 

 
footer { 
 
\t clear: both; 
 
\t margin: 0PX; 
 
\t text-align: center; 
 
\t position: fixed; 
 
\t left: 0px; 
 
\t bottom: 0px; 
 
\t height: 80px; 
 
\t width: 100%; 
 
\t padding-top: 56px; 
 
\t 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%); 
 
\t 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%); 
 
\t 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%); 
 
\t 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 { 
 
\t width: 55%; 
 
\t clear: right; 
 
\t float: right; 
 
\t border-top-right-radius: 50px; 
 
\t margin-right: 5%; 
 
\t margin-left: 1%; 
 
\t padding-left: 2.5%; 
 
\t padding-right: 2.5%; 
 
\t margin-top: 30px; 
 
\t padding-bottom: 42px; 
 
\t margin-bottom: 68px; 
 
\t padding-top: 24px; 
 
} 
 

 

 

 
h1 { 
 
\t font-size: 3em; 
 
\t font-family: alfa-slab-one; 
 
\t font-style: normal; 
 
\t font-weight: 400; 
 
\t line-height: 1em; 
 
\t text-align: center; 
 
\t color: #EFEFEF; 
 
\t text-shadow: 2px 2px 10px #353535; 
 
} 
 
h2 { 
 
\t text-align: center; 
 
\t font-size: 2.em; 
 
\t font-family: alfa-slab-one; 
 
\t font-style: normal; 
 
\t font-weight: 400; 
 
\t font-size: 1em; 
 
\t line-height: 2em; 
 
} 
 
.AsideLeft { 
 
\t width: 28%; 
 
\t float: left; 
 
\t margin-right: 1%; 
 
\t margin-left: 5%; 
 
\t padding-bottom: 0px; 
 
} 
 
header { 
 
\t text-align: center; 
 
\t margin-top: 20px; 
 
\t margin-bottom: 30px; 
 
} 
 
.NavList { 
 
\t padding: 0px; 
 
\t margin: 0px; 
 
\t list-style-type: none; 
 
\t overflow: hidden; 
 
} 
 
.container-fluid .navbar-header .navbar-brand { 
 
\t font-family: alfa-slab-one; 
 
\t font-style: normal; 
 
\t font-weight: 400; 
 
\t color: #3F3F3F; 
 
} 
 

 

 
@media (max-width : 714px){ 
 
.AsideLeft { 
 
\t width: 90%; 
 
\t float: none; 
 
\t margin-right: 5%; 
 
\t margin-left: 5%; 
 
\t padding-bottom: 0px; 
 
} 
 
.AsideRight { 
 
\t width: 90%; 
 
\t clear: right; 
 
\t float: none; 
 
\t border-top-right-radius: 50px; 
 
\t margin-right: 5%; 
 
\t margin-left: 5%; 
 
\t 
 
} 
 
h1 { 
 
\t font-size: 2.2em; 
 
\t font-family: alfa-slab-one; 
 
\t font-style: normal; 
 
\t font-weight: 400; 
 
\t line-height: 1em; 
 
\t text-align: center; 
 
\t color: #EFEFEF; 
 
\t text-shadow: 2px 2px 10px #353535; 
 
} 
 
body { 
 
\t background-color: #737373; 
 
/* \t background-image: url(../Images/bkgd.jpg); 
 
*/ \t background-size: cover; 
 
\t color: #3A3A3A; 
 
\t text-align: left; 
 
\t font-family: advent-pro; 
 
\t font-style: normal; 
 
\t margin: 0px; 
 
\t font-weight: 400; 
 
\t 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 { 
 
\t 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> 
 
    \t \t <li class="NavListItem"><a href="Contact.html">Contact</a></li> 
 
    \t <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>

回答

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; 
} 
+0

哦,没有工作,我没有得到它什么我的代码的问题,感谢队友 –

相关问题