Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>My React Project on CodePen</title>
  <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyARATzKOf2nxzpW1uZ708KiRpodi9ZkzgE&sensor=false" type="text/javascript"></script>
</head>

<body>
  <div id="root"></div>
  <div id="content">
    <h2>Custom Popup</h2>
    <p>Can be used to render HTML markup.</p>
  </div>
</body>

</html>
              
            
!

CSS

              
                body {
  margin: 0;
}

#map {
  height: 100vh;
  width: 100vw;
}

/* The popup bubble styling. */
.popup-bubble {
  /* Position the bubble centred-above its parent. */
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -100%);
  /* Style the bubble. */
  background-color: white;
  padding: 10px 10px 20px;
  border-radius: 5px;
  font-family: sans-serif;
  overflow-y: auto;
  max-height: 60px;
  box-shadow: 0px 2px 10px 1px rgba(0, 0, 0, 0.5);
  background: pink;
}
/* The parent of the bubble. A zero-height div at the top of the tip. */
.popup-bubble-anchor {
  /* Position the div a fixed distance above the tip. */
  position: absolute;
  width: 100%;
  bottom: 8px;
  left: 0;
}
/* This element draws the tip. */
.popup-bubble-anchor::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  /* Center the tip horizontally. */
  transform: translate(-50%, 0);
  /* The tip is a https://css-tricks.com/snippets/css/css-triangle/ */
  width: 0;
  height: 0;
  /* The tip is 8px high, and 12px wide. */
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid black;
}
/* JavaScript will position this div at the bottom of the popup tip. */
.popup-container {
  cursor: auto;
  height: 0;
  position: absolute;
  /* The max width of the info window. */
  width: 200px;
}

              
            
!

JS

              
                // This example displays a marker at the center of Australia.
// When the user clicks the marker, an info window opens.

(function() {
   class Map extends React.Component {
      /** DOM container where the map canvas gets rendered. */
      mapContainer = React.createRef();

      componentDidMount() {
         /** Create new google map. */
         this.map = new google.maps.Map(this.mapContainer.current, {
            zoom: this.props.zoom,
            center: this.props.center
         });
      }
      render() {
         // reference to the DOM element where the map will be rendered
         return (
            <div
               ref={this.mapContainer}
               style={{ height: "100vh", width: "100vw" }}
            />
         );
      }
   }

   ReactDOM.render(
      <Map
         zoom={13}
         center={{
            lat: 37.8145864,
            lng: -122.4784945
         }}
      />,
      document.getElementById("root")
   );
})();

              
            
!
999px

Console