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

              
                <div id='bordermap' data-id='29' style='width:800px; height:647px; background-size:800px; background-color:#eeeeee;'>
	<div id='25' class='specimen size_20' style='top:366px; left:562px; background-color:rgba(238,130,238,0.5); border-color:rgba(238,130,238,1);' data-species='Agastache mexicana'>a</div>
	<div id='89' class='specimen size_20' style='top:333px; left:539px; background-color:rgba(238,130,238,0.5); border-color:rgba(238,130,238,1);' data-species='Agastache mexicana'>a</div>
	<div id='76' class='specimen size_20' style='top:434px; left:467px; background-color:rgba(238,130,238,0.5); border-color:rgba(238,130,238,1);' data-species='Agastache mexicana'>a</div>
	<div id='31' class='specimen size_40' style='top:220px; left:332px; background-color:rgba(255,255,224,0.5); border-color:rgba(155,155,155,1);' data-species='Foeniculum vulgare'>d</div>
	<div id='66' class='specimen size_40' style='top:451px; left:656px; background-color:rgba(106,90,205,0.5); border-color:rgba(106,90,205,1);' data-species='Geranium &#39;Rozanne&#39;'>f</div>
	<div id='82' class='specimen size_20' style='top:280px; left:336px; background-color:rgba(216,191,216,0.5); border-color:rgba(216,191,216,1);' data-species='Penstemon digitalis &#39;Dark Towers&#39;'>j</div>
	<div id='83' class='specimen size_20' style='top:192px; left:442px; background-color:rgba(216,191,216,0.5); border-color:rgba(216,191,216,1);' data-species='Penstemon digitalis &#39;Dark Towers&#39;'>j</div>
	<div id='43' class='specimen size_20' style='top:209px; left:226px; background-color:rgba(255,255,0,0.5); border-color:rgba(255,255,0,1);' data-species='Rudbeckia hirta'>k</div>
	<div id='44' class='specimen size_20' style='top:223px; left:272px; background-color:rgba(255,255,0,0.5); border-color:rgba(255,255,0,1);' data-species='Rudbeckia hirta'>k</div>
	<div id='45' class='specimen size_20' style='top:257px; left:250px; background-color:rgba(255,255,0,0.5); border-color:rgba(255,255,0,1);' data-species='Rudbeckia hirta'>k</div>
	<div id='46' class='specimen size_20' style='top:450px; left:619px; background-color:rgba(255,215,0,0.5); border-color:rgba(255,215,0,1);' data-species='Rudbeckia nitida &#39;Herbstsonne&#39;'>l</div>
	<div id='95' class='specimen size_20' style='top:304px; left:534px; background-color:rgba(255,255,224,0.5); border-color:rgba(155,155,155,1);' data-species='Tellima grandiflora'>m</div>
	<div id='34' class='specimen size_20' style='top:308px; left:444px; background-color:rgba(148,0,211,0.5); border-color:rgba(148,0,211,1);' data-species='Verbena bonariensis'>n</div>
	<div id='35' class='specimen size_20' style='top:327px; left:420px; background-color:rgba(148,0,211,0.5); border-color:rgba(148,0,211,1);' data-species='Verbena bonariensis'>n</div>

	<div id='description'>I should be PHP/mysql generated text!</div>
</div>
              
            
!

CSS

              
                /* plant pin */
.specimen {
    
    position: absolute;
    border-style:solid; 
    border-width:2px; 
    border-radius: 50%;
    box-shadow: 2px 2px 2px black;  
    text-align: center;
    font-size: 10px;
    cursor: pointer;
}

/* popup 'window' */
#description {
    position: absolute;
    width: 300px;
    height: 200px;
    border-radius: 5px;  
    border: 2px solid black;
    background-color: white;
    box-shadow: 5px 5px 5px grey;  
    z-index: 40;
    display: none;
}

/* php generated */
.size_40 { width: 29px; height: 29px; z-index: 14; line-height:29px; }
.size_20 { width: 13px; height: 13px; z-index: 15; line-height:13px; }
              
            
!

JS

              
                document.addEventListener("click", onClick);

function onClick(){
 
var className = event.target.className;
	
 if( className.includes("specimen") ){
	 
	var popup   = document.getElementById('description');  
	var map     = document.getElementById('bordermap');  
	var rect    = map.getBoundingClientRect();
	var x       = event.clientX - rect.left;
	var y       = event.clientY - rect.top; 
	
	popup.style.display = "grid";     
	popup.style.left = x+"px";            
	popup.style.top  = y+"px"; 
 }	 
}
              
            
!
999px

Console