2009-07-29 72 views

回答

0

是的,我过去做过这件事,可能相当棘手。你需要使用萤火虫来找出你需要的选择器,并且在你的CSS中,你必须非常具体地覆盖它们,在occaision中你甚至可能必须使用!

娜塔莉

+0

多数民众赞成在很大程度上,我会如何去做,外部文件需要链接到哪里? 任何例子,你可以指出我。 关于。 .k – Keet 2009-08-06 20:19:25

3

我通常做的是创造我的一个包含包装div用CSS类像earth-balloon,然后可以从包含页面内直接称呼标气球一个BalloonStyle中。

例如,KML看起来像:通过类似规则

<html> 
<head> 
    <link rel="stylesheet" type="text/css" href="styles.css"/> 
    <!-- Earth API stuff goes here --> 
</head> 
<body> 
    <div id="map3d"></div> 
</body> 
</html> 

和你styles.css然后才能风格地标气球与styleUrl = #foo

<?xml version="1.0" encoding="UTF-8"?> 
<kml xmlns="http://www.opengis.net/kml/2.2"> 
    <Document> 
    <Style id="foo"> 
     <BalloonStyle> 
     <text><![CDATA[ 
     <div class="earth-balloon"> 
      $[description] 
     </div> 
     ]]></text> 
     </BalloonStyle> 
    </Style> 
    <Placemark> 
     <styleUrl>#foo</styleUrl> 
     <name>Bar</name> 
     <description><![CDATA[ 
     Some <em>HTML</em> here. 
     ]]></description> 
     <Point> 
     <coordinates>-122,37</coordinates> 
     </Point> 
    </Placemark> 
    </Document> 
</kml> 

包含页面本身可能看起来像:

.earth-balloon { 
    font-family: Georgia, serif; 
} 

.earth-balloon em { 
    color: red; 
} 

希望有帮助!