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

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

              
                <script type="application/ld+json">	
{
	"@context":"http://schema.org",
	"@id":"http://data.wordlift.io/wl0116/entity/wordpress",
	"@type":"CreativeWork",
	"name":"WordPress",
	"description":"WordPress is a free and open source blogging tool and content management system (CMS) based on PHP and MySQL. It has many features including a plug-in architecture and a template system. WordPress is currently the most popular blogging system in use on the Web, powering over 8 Content Management System and the trend is growing Insideout10 […]",
	"image":[
		"https://wordlift.io/wp-content/uploads/2016/10/wordpress-logo-640x360.png",
		"https://s.w.org/style/images/wp-header-logo.png"
	],
	"sameAs":[
		"http://rdf.freebase.com/ns/m.02vtpl",
		"http://yago-knowledge.org/resource/WordPress",
		"http://dbpedia.org/resource/WordPress"
	],
	"url":"https://wordlift.io/entity/wordpress/"
}
</script>
<div id="container">
	<h1>Click on the buttons to load content </h1>
	<hr />
	<span>
		1.
		<button id="head">Load the heading</button>
	</span>
	<span>
		2.
		<button id="image">Load the image</button>
	</span>
	<span>
		3.
		<button id="description">Load the description</button>
	</span>
	<hr />
</div>


              
            
!

CSS

              
                body 
	background-color: #f5f5f5
	display: flex
	align-items: center
	justify-content: center
	padding-top: 30px
	// Text job.
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif

	*
		box-sizing: border-box

#container	
	// Size.
	width: 700px
	// Border.
	border: 1px solid #e5e5e5
	border-radius: 4px
	// Color.
	background-color: #fff
	box-shadow: 0 1px 1px rgba(0,0,0,.04)
	// Internal.
	padding: 32px

h1
	// Color. 
	color: #666
	// Spacing.
	margin: 16px 0 8px 0

hr
	// Spacing.
	margin: 16px 0

span
	display: inline-flex
	align-items: center
	justify-content: space-around


button
	// Position.
	display: inline-flex
	position: relative
	// Color.
	background-color: green
	color: white
	// Border
	border: 0
	// Internal.
	padding: 8px 16px
	// Spacing
	margin: 16px 16px 16px 8px
	
              
            
!

JS

              
                // Importing and parse JSON.
var json = JSON.parse( $('script[type="application/ld+json"]').text() );

// Log the JSON
// console.log(json);

// Storing the space.
const cont = document.getElementById('container');

// Print the name.
var heading = document.createElement('H1');
heading.innerHTML = json.name;

document.getElementById('head').addEventListener('click',function(){
	cont.appendChild(heading);
} )


// Print the image.
var image = document.createElement('img');
image.setAttribute('src', json.image[1]);

document.getElementById('image').addEventListener('click',function(){
	cont.appendChild(image);
} )

// Print the description.
var description = document.createElement('p');
description.innerHTML = json.description;

document.getElementById('description').addEventListener('click',function(){
	cont.appendChild(description);
} )

              
            
!
999px

Console