Openlayers 开放层。标记信息太大

Openlayers 开放层。标记信息太大,openlayers,Openlayers,我用这段代码在地图上显示一个标记,我使用openlayers(一个开源javascript库来加载、显示和渲染网页上多个源的地图),但是弹出窗口太大了 <div class="windowContentMap"> <div> <div id="Map"></div> <script src="http://

我用这段代码在地图上显示一个标记,我使用openlayers(一个开源javascript库来加载、显示和渲染网页上多个源的地图),但是弹出窗口太大了

 <div class="windowContentMap">
                    <div>
                       <div id="Map"></div>
                         <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
                        <script>
                            var lat            = '50.8340150';
                            var lon            = '4.3778850';
                            var zoom           = 18;

                            var fromProjection = new OpenLayers.Projection("EPSG:4326");   // Transform from WGS 1984
                            var toProjection   = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
                            var position       = new OpenLayers.LonLat(lon, lat).transform( fromProjection, toProjection);

                            map = new OpenLayers.Map("Map");
                            var mapnik         = new OpenLayers.Layer.OSM();
                            map.addLayer(mapnik);

                            var markers = new OpenLayers.Layer.Markers( "Markers" );
                            map.addLayer(markers);
                            markers.addMarker(new OpenLayers.Marker(position));
                            map.setCenter(position, zoom);
                            // The location of our marker and popup. We usually think in geographic
                            // coordinates ('EPSG:4326'), but the map is projected ('EPSG:3857').
                            var myLocation = new OpenLayers.Geometry.Point(lon, lat).transform('EPSG:4326', 'EPSG:3857');

                            // A popup with some information about our location
                            var popup = new OpenLayers.Popup.FramedCloud("Popup",
                            myLocation.getBounds().getCenterLonLat(), null,
                            //'<a target="_blank" href="http://openlayers.org/">We</a> ' +
                            'E506  (TD1204 EVB)', null,
                            true // <-- true if we want a close (X) button, false otherwise
                        );
                        map.addPopup(popup);
                        </script>

                    </div>
                </div>

var lat='50.8340150';
var-lon='4.3778850';
var zoom=18;
var fromProjection=newopenlayers.Projection(“EPSG:4326”);//从WGS 1984转换而来
var toProjection=新OpenLayers.Projection(“EPSG:900913”);//球面墨卡托投影
var位置=新OpenLayers.LonLat(lon,lat).变换(fromProjection,toProjection);
map=新的OpenLayers.map(“map”);
var mapnik=new OpenLayers.Layer.OSM();
map.addLayer(mapnik);
var markers=新的OpenLayers.Layer.markers(“markers”);
添加图层(标记);
markers.addMarker(新OpenLayers.Marker(位置));
地图设置中心(位置、缩放);
//标记和弹出窗口的位置。我们通常用地理思维
//坐标('EPSG:4326'),但地图是投影的('EPSG:3857')。
var myLocation=newopenlayers.Geometry.Point(lon,lat).transform('EPSG:4326','EPSG:3857');
//一个弹出窗口,包含一些关于我们位置的信息
var popup=new OpenLayers.popup.FramedCloud(“popup”,
myLocation.getBounds().getCenterLonLat(),null,
//' ' +
“E506(TD1204 EVB)”为空,

true/您可以使用元素id或覆盖
olPopup
css类来设置弹出窗口的样式:

var popup = new OpenLayers.Popup.FramedCloud("yourPopup",
        yourLonLat,
        null,
        htmlCode, //for example a table
        null,
        true,
        function () {
            //close popup function
        }
    );
在css文件中编写如下内容:

#yourPopup {
    width: 100px !important;
    height: 50px !important;
    /*set any style*/
}
或:

.olPopup {
    /*set any style*/
}