Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
	<head>
		<title>Ultimate Guide to Openlayers: Free Maps for the Web</title>
		<style>
		#map {
			height: 500px;
			width: 500px;
		}
		</style>
		<script src="//maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
		<script src="https://openlayers.org/dev/OpenLayers.js"></script>
	</head>
	<body>
		<div id="map"></div>
		<script>
			//Convert the coordinates into GPS format
			var cent_lonlat = new OpenLayers.LonLat(77.2300, 28.6100)
				.transform(new OpenLayers.Projection('EPSG:4326'), new OpenLayers.Projection('EPSG:3857'));

			//The layers
			var osm_layer = new OpenLayers.Layer.OSM();

			//Google Roadmap
			var gphr = new OpenLayers.Layer.Google(
                        "Google Roadmap", {
                            type: google.maps.MapTypeId.ROADMAP
                        }
                    );
			//Google Physical
			var gphy = new OpenLayers.Layer.Google(
				"Google Physical", {
					type: google.maps.MapTypeId.TERRAIN
				}
			);
			//Google Hybrid
			var ghyb = new OpenLayers.Layer.Google(
				"Google Hybrid", {
					type: google.maps.MapTypeId.HYBRID
				}
			);
			//Google Satellite
			var gsat = new OpenLayers.Layer.Google(
				"Google Satellite", {
					type: google.maps.MapTypeId.SATELLITE
				}
			);

			var map = new OpenLayers.Map({
				div: "map",
				displayProjection: new OpenLayers.Projection("EPSG:4326", "EPSG:3857"),
				center: cent_lonlat,
				zoom: 5,
				layers: [osm_layer, gphr, gphy, ghyb, gsat]
			});
			var baseLayer = map.getLayersByName("Google Hybrid")[0];
			map.setBaseLayer(baseLayer);

			//Add the Layer switcher control
			//to switch between layers
			map.addControl(new OpenLayers.Control.LayerSwitcher());
			map.addControl(new OpenLayers.Control.PanZoomBar());
		</script>
	</body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console