当地图很小时,如何在Google地图包装中制作版权文本?

时间:2010-03-16 11:34:23

标签: javascript jquery css google-maps internet-explorer-8

当您在网页上嵌入Google地图时,地图上会包含版权文字。

如果您嵌入了宽度较小的地图,则版权文字会延伸到<div>之外,而不是包含在其中的两行。

这是Google地图为版权文字插入的HTML:

<div style="-moz-user-select: none; z-index: 0; position: absolute; right: 3px; bottom: 2px; color: black; font-family: Arial,sans-serif; font-size: 11px; white-space: nowrap; text-align: right;" dir="ltr">
    <span></span>
    <span>Map data &copy;2010  LeadDog Consulting, Europa Technologies - </span>
    <a href="http://www.google.com/intl/en_ALL/help/terms_maps.html" target="_blank" class="gmnoprint terms-of-use-link" style="color: rgb(119, 119, 204);">Terms of Use</a>
    <span></span>
</div>

我尝试使用jQuery根据其内容选择此HTML(使用:contains())并以不同的方式设置样式,但IE 8中没有应用任何样式。它们在IE 7中应用得很好Firefox浏览器。

$('.map_placeholder div:contains("Map data ")').css({'white-space': 'normal', 'margin-left': '70px', 'width': '210px', 'border-top': 'solid 10px #c00'});
  • 知道IE 8的用途是什么吗?
  • 你知道其他方法可以达到同样的效果吗?

3 个答案:

答案 0 :(得分:3)

div span { white-space: normal;}

答案 1 :(得分:1)

您应该可以在外部overflow:hidden设置div,并且不会在其框外扩展任何内容。

我会谨慎删除/设置版权文本,因为它可能违反了Google的服务条款。

答案 2 :(得分:1)

刚试过这个,它确实有效。使用以下内容覆盖内联css:

div[style]{
 font-size: inherit !important;
 white-space: inherit !important;
}


span[style]{
 white-space: inherit !important;
}

a[style]{
 color: inherit !important;
}

span { white-space: normal; }