

In the example below, I’ve added the code above to a page of my blog.

The width attribute means that, on a screen narrower than 560 pixels, the embedded content will protrude outside of its containing element, breaking the layout. And you can’t fix this in your style sheet, unfortunately. Remove these and the iframe will disappear because it would have no dimensions. However, you’ll notice that our iframe includes width and height attributes. This iframe enables external content to be displayed on your website, because it includes a URL that points to the source of the streamed content. When you embed content from an external source, the code will include an iframe: The two main ways to embed video on a website are the HTML5 video element, which doesn’t work in legacy versions of Internet Explorer, and Flash, which doesn’t work on iOS devices and isn’t standards-compliant. I tend to recommend to my clients that they host video with YouTube because it will save them server space and, regardless of the user’s browser or device, YouTube will display the video correctly.

Services such as YouTube provide code that you can copy and paste into your own website to embed content. I’ve used techniques I learned from his tutorial and expanded on them here for additional content types such as calendars. Note: This technique was originally detailed in Thierry Koblenz’s excellent tutorial ‘ Creating Intrinsic Ratios for Video’.
