Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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



Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO


Save Automatically?

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.


Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:


Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO


                <html lang="en">
    <title>test format kml</title>
    <div id="map" class="map"></div>
      <input type="radio" id="interaction_type_draw" name="interaction_type" value="draw" checked>
      <label>Geometry type</label>
      <select id="geom_type">
        <option value="LineString" selected>LineString</option>


                .map {
  height: 400px;
  width: 600px;


                // create a vector layer used for editing
var vector_layer = new ol.layer.Vector({
  name: 'my_vectorlayer',
  source: new ol.source.Vector(),
  style: new{
    fill: new{
      color: 'rgba(255, 255, 255, 0.2)'
    stroke: new{
      color: '#ffcc33',
      width: 2
    image: new{
      radius: 7,
      fill: new{
        color: '#ffcc33'

// Create a map
var map = new ol.Map({
  target: 'map',
  layers: [
    new ol.layer.Tile({
      source: new ol.source.OSM()
  view: new ol.View({
    zoom: 2,
    center: [0, 0]

// make interactions global so they can later be removed
var select_interaction,

// get the interaction type
var $interaction_type = $('[name="interaction_type"]');
// rebuild interaction when changed
$interaction_type.on('click', function(e) {
  // add new interaction
  if (this.value === 'draw') {

// get geometry type
var $geom_type = $('#geom_type');
// rebuild interaction when the geometry type is changed
$geom_type.on('change', function(e) {

// get data type to save in
$data_type = $('#data_type');
// clear map and rebuild interaction when changed
$data_type.onchange = function() {

// creates a draw interaction
function addDrawInteraction() {
  // remove other interactions
  // create the interaction
  draw_interaction = new ol.interaction.Draw({
    source: vector_layer.getSource(),
    type: /** @type {ol.geom.GeometryType} */ ($geom_type.val())
	// add it to the map

  // when a new feature has been drawn...
  draw_interaction.on('drawstart', function(evt) {
    var feature = evt.feature;
    var geom = feature.getGeometry();
    document.addEventListener('keyup', function() {
      if (event.keyCode === 27) {
        if (geom.getType() === "LineString") {
          var coords = geom.getCoordinates();
          var len = coords.length;
          if (len > 1) {
           geom.setCoordinates(geom.getCoordinates().slice(0, len - 1));
  // when a new feature has been drawn...
  draw_interaction.on('drawend', function(event) {
    // create a unique id
    // it is later needed to delete features
    var id = uid();
    // give the feature his id

// add the draw interaction when the page is first shown

// clears the map and the output of the data
function clearMap() {
  if (select_interaction) {

// creates unique id's
function uid(){
  var id = 0;
  return function() {
    if (arguments[0] === 0) {
      id = 0;
    return id++;
Learning 3D transforms in CSS requires a little perspective.