Heads up! This blog post hasn't been updated in over 2 years. CodePen is an ever changing place, so if this post references features, you're probably better off checking the docs. Get in touch with support if you have further questions.
Embedded Pens are always ultimately iframes, but now we’re offering
<iframe> style embed code right from the Embed Builder. We still recommend the HTML embeds, but the straight iframe might be useful in some situations.
The reason that we went with HTML embeds (basically a
<div> with information about the Pen and a link to it on CodePen that gets turned into an
Even more importantly, embeds are most often used in blog posts. Some people read blogs through RSS. RSS readers traditionally have stripped out iframes. Just totally removed, nothing left, not even the fallback stuff (e.g.
<iframe>fallback</iframe>) that we provide. It’s a much better RSS reading experience if there is at least a link to the Pen.
I’m sure this is true for most feed readers still. But I noticed in Feedly, the one I happened to be using at the moment, that iframes are no longer stripped but show a “Tap to load frame” box instead. If you tap it, the iframe will load. Embedded Pens through RSS! At least in Feedly anyway, nice!
As I said, we still recommend sticking with the regular HTML embeds for the most part since it’s guaranteed you’ll get a working fallback, but now the choice is up to you.