【发布时间】:2017-08-30 17:46:32
【问题描述】:
我遇到了一个问题,经过多次谷歌搜索后我没有找到答案。我有一个带有静态谷歌地图(大小 400x300)的基本网站,我通过 600 像素的媒体查询使网站响应。
<p>
<img id="karte" alt="Geolocation" src="http://maps.google.com/maps/api/staticmap?&size=400x300&sensor=false&maptype=roadmap&markers=color:green|label:B|Stuttgart&markers=color:green|label:A|Hamburg">
</p>
小提琴在这里:https://jsfiddle.net/bLahadgu/
当我将屏幕缩小到 600 像素时,图像之外的所有内容都变得流畅,但图像仅在 400 像素或更低时才变得流畅。如果我删除size=400x300&amp;,则根本不会出现该图像。我检查了CSS代码,似乎没问题。
对于正常的屏幕尺寸
img, #karte{
width:400px;
height:300px;
}
对于小屏幕(在媒体查询内):
img, #karte{
max-width: 100% !important;
height: auto;
float: none;
margin: 0;
}
还确保支架、内容等也调整为较小的屏幕:
@media all and (max-width: 600px){
header, #content, #holder, section, nav, article, footer, .callout{
clear: both;
display: block;
width: 100% ! important;
float: none;
margin: 0;
padding: 0;
}
}
我认为它可能是<p>,但在 600 像素处都变得流畅,只是不是图像。
我的 CSS 代码中是否缺少某些内容或静态图像的行为方式?
【问题讨论】:
标签: jquery html css google-maps-api-3