【问题标题】:Google maps V3 API - css reset causes scrollbars谷歌地图 V3 API - css 重置导致滚动条
【发布时间】:2010-07-08 05:49:29
【问题描述】:

这是在我的重置脚本中:

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
 margin: 0;
 padding: 0;
 border: 0;
 outline: 0;
 font-weight: inherit;
 font-style: inherit;
 font-size: 100%;
 font-family: inherit;
 vertical-align: baseline;
}

除非我的 CSS 中有此代码,否则我的 google 代码会调整信息窗口以适应内容。通过反复试验,我发现如果我删除 margin:0 ,那么滚动条就会消失并且内容会正确匹配,并且信息窗口会按预期调整大小。

我还发现,如果我从标签列表中删除“p”,它也可以工作 - 所以我假设我不能在我的重置脚本中将边距设置为 0。

我不知道如何解决这个问题。没有意义!

这段代码确实有效,谷歌地图信息窗口很好:

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
 margin: 0;
 padding: 0;
 border: 0;
 outline: 0;
 font-weight: inherit;
 font-style: inherit;
 font-size: 100%;
 font-family: inherit;
 vertical-align: baseline;
}
p{
 padding: 0;
 border: 0;
 outline: 0;
 font-weight: inherit;
 font-style: inherit;
 font-size: 100%;
 font-family: inherit;
 vertical-align: baseline;
}

【问题讨论】:

    标签: css maps reset css-reset


    【解决方案1】:

    您如何在您的网页中加入 Google 地图?是弹窗吗?一个iframe?还是直接嵌入到某个页面中,例如contactus.html?在不知道 HTML 是如何工作的情况下,很难查明错误。另外,这只是在 IE 中发生,还是在多个浏览器中发生?了解范围有助于确定是浏览器问题还是编码问题。

    如果可能,我的解决方案是为带有 Google 地图的网页使用不同的样式表。这样您就不必处理 reset.css 文件中的任何问题。

    【讨论】:

    • 代码是页面上的一个DIV,即
      。该地图是通过脚本放置的,即 var latlng = new google.maps.LatLng(-16.43,136.09); var myOptions = { zoom: 2, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map"),myOptions);很基本的东西。目前我只是全局修改了重置脚本,因为唯一改变的是

      标签上的边距。

    猜你喜欢
    • 2012-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-03
    • 2014-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多