DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

How to Use CodePen With the DZone Editor

In this post, we take a look at how to embed your work in CodePen into your DZone article to better show off your amazing ideas!

Jordan Baker user avatar by
Jordan Baker
·
Aug. 23, 18 · Tutorial
Like (1)
Save
Tweet
Share
2.49K Views

Join the DZone community and get the full member experience.

Join For Free

So, it turns out that using CodePen with the DZone editor is actually extremely easy. Phew! To get started, head on over to your CodePen profile and open up a Pen. (Pauses for a few seconds...) Great job! If we're all on the same page (though hopefully not the same web page, or else you've hacked my super anti-climactic CodePen account), you should be on the CodePen editor, and see something like this: 

Image title

If that picture is super blurry, don't worry, the very basic code in it isn't super important; I just want to make sure those uninitiated with CodePen have no problem in following along. 

Okay, so, now that you're in the CodePen editor, you should see a little button on the bottom right hand corner that's labeled 'Embed.' It looks like ça: 

Image title

Once you've clicked the 'Embed' button, another in-window pop-up should, well, pop up. There are a bunch of options contained in this window, but we're only concerned with that most elusive of prey for online content creators, the iframe. 

Image title

When this window opened for me, it defaulted to showing the 'HTML (recommended)' tab at the the bottom in the 'Copy & Paste Code' section. But, as you can see, there's a tab labeled 'iframe' direclty to its left. Click on that tab. 

Image title

You should now see an iframe appear in the box. Go ahead and copy all of that HTML. 

Now we're going to be switching over to our DZone editor. 

Once logged into your DZone editor, you should see a toolbar like this: 

Image title

That icon on the far right that looks like an HTML tag (</>). Well, coincidentally, that's how to get to the part of the editor that allows you to edit the HTML of your article. I wonder if they did that on purpose... Well, either way, click on that button. Now, paste that iframe from CodePen into our HTML. But, for our iframe to work, we need to add https: in front of the src attribute assigned to the iframe by CodePen.  

For example, my iframe from CodePen originally looked like this: 

<iframe height='265' scrolling='no' title='OwdXBm' src='//codepen.io/pjabker2/embed/OwdXBm/?height=265&theme-id=0&default-tab=js,result&embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'>See the Pen <a href='https://codepen.io/pjabker2/pen/OwdXBm/'>OwdXBm</a> by Jordan (<a href='https://codepen.io/pjabker2'>@pjabker2</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>

In order for it to work with our CMS (because we like secure sites), I had to tweak it to this: 

<iframe height='265' scrolling='no' title='OwdXBm' src='https://codepen.io/pjabker2/embed/OwdXBm/?height=265&theme-id=0&default-tab=js,result&embed-version=2' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'>See the Pen <a href='https://codepen.io/pjabker2/pen/OwdXBm/'>OwdXBm</a> by Jordan (<a href='https://codepen.io/pjabker2'>@pjabker2</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>

This lets DZone.com know that the iframe originated from a secure site based upon the latest HTTPS protocol. 

And... BAM!

Thanks! Hope y'all enjoyed the post.

CodePen DZone

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • AWS CodeCommit and GitKraken Basics: Essential Skills for Every Developer
  • Microservices 101: Transactional Outbox and Inbox
  • Strategies for Kubernetes Cluster Administrators: Understanding Pod Scheduling
  • A Deep Dive Into AIOps and MLOps

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: