我目前正试图用只有移动版本的网站上的图像替换另一图像。我试图改变图像只使用CSS媒体查询,但目前不工作。有人可以帮助我发现我的错误,我认为是其中一个母公司不允许更改,但我不确定。用移动设备上的另一个图像替换一个图像HTML
我试图用代码中的第一个ID“left-image”替换图像。
下面是HTML代码:
<div class="container-fluid">
<div class="row " id= "faded">
<img src = "img/logo.png" class ="img-responsive" id = "logo">
<div class = "col-md-3 col-sm-3 col-xs-12" >
<img src = "img/1.jpg" class = "img-responsive" id ="left-image">
<div class = "carousel-caption" id = "pricing">
<h3>PRICING</h3>
</div>
<div class = "text">
HAIRCUT $60<br>
SHAVE $30<br>
COMBO $80<br>
</div>
</div>
<div class = "col-md-6 col-sm-6 col-xs-12">
<img src = "img/2.jpg" class = "img-responsive" id = "middle-image">
<div class ="carousel-caption" id = "about-us">
<h3> ABOUT US </h3>
</div>
<div class = "text-third">
<p>FADED IS HERE AND WE'RE BRINGING YOU<br>
THE BEST BARBERS FROM ACROSS THE COUNTRY.<br>
COME EXPERIENCE THE DIFFERENCE FOR YOURSELF</p>
</div>
<a href="mailto:[email protected]">
<img src = "img/3.jpg" class = "img-responsive" id= "mid-image">
<div class ="carousel-caption" id = "contact-us">
<h3> CONTACT US </h3>
</div>
<div class = "text-second">
<p>5819 W 4TH ST.<br>
LOS ANGELES, CA 90036<br><br>
[email protected]<br>
310.123.4567</p>
</div>
</a>
</div>
<a href = "https://squareup.com/appointments/book/WBBT3O/faded">
<div class = " col-md-3 col-sm-3 col-xs-12">
<img src = "img/4.jpg" class = "img-responsive" id = "right-image">
<div class ="carousel-caption" id = "appointments">
<h3> APPOINTMENTS </h3>
</div>
<div class ="text-four">
CLICK HERE TO<br>
GET FADED
</div>
</div>
</a>
</div>
</div>
,这里是为网站的CSS,以及:
@media only screen and (max-width: 800px) {
.text, .text-second, .text-four{
font-size:1em;
}
.text-third{
font-size:0.8em;
}
h2, h3{
font-size:15px;
}
#logo{
width: 25%;
}
#pricing{
bottom:83%;
left:-30%;
font-size:2.5em;
}
#about-us{
bottom:83%;
left: -55%;
}
#contact-us{
bottom: 34%;
right:-53%;
}
#appointments{
bottom:83%;
right:25%;
}
}
@media only screen and (max width: 480px) and (max width: 640px){
#left-image{
background-image: url("img/mobile/mobile1.jpg");
}
}
'max widt h'应该是'max-width'。更改'max width:480px)和(最大宽度:640px' ==>'max-width:480px)和(max-width:640px' – Tushar
'!= background-image' – putvande
进行了更改,但图像仍然是移动设备也一样。 – ZombieChowder