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 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


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.


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.


<h1>I left my heart in 37°47′N 122°25′W</h1>
<h2>US States in TopoJSON · Rendered in SVG with D3.js</h2>

<section id="map" class="map"></section>


                * {
	box-sizing: border-box;
html, input {
    font-family: "Segoe UI Web Light", "Segoe UI Light", "Segoe UI Web Regular", "Segoe UI", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, sans-serif; 
html {
    -ms-text-size-adjust: none;
body {
    margin: 1.5em;
    background: #272727;
    color: #ecf0f0;
h1 {
	font-size: 3.25em;
  margin: 0;
  font-weight: normal;
h2 {
	font-size: 1.2em;
	text-transform: uppercase;
  font-weight: normal;
a {
	color: #55acee;

/* topology */

.states {
	stroke: #fff;
	stroke-width: 1px;
	stroke-linejoin: round;

	-webkit-transition: fill 1s;
    transition: fill 1s;

.states.CA {
  fill: #FF8586;


                (function() {  
  var width = 900;
	var height = 540;

	var projection = d3.geo.albersUsa();

	var color = d3.scale.linear()
		.domain([0, 15])
		.range(['#5b5858', '#4f4d4d', '#454444', '#323131']);

	var svg ='#map').append('svg')
			.attr('width', width)
			.attr('height', height);

	var path = d3.geo.path()

	var g = svg.append('g');

	d3.json('', function(error, topology) {
			.data(topojson.feature(topology, topology.objects.usStates).features)
			.attr('class', function(d){ return 'states ' +;} )
			.attr('d', path)
			.attr('fill', function(d, i) { return color(i); })
  // San Francisco 
  var position = projection([-122.25, 37.47]);
  var heart = svg.selectAll('text').data([0]);
    .attr('font-size', 34)
    .attr('fill', '#CE1126')
    .attr('transform', function(d) {return 'translate(' + position + ')';})