{"id":12139,"date":"2021-11-09T16:16:22","date_gmt":"2021-11-09T21:16:22","guid":{"rendered":"https:\/\/www.med.unc.edu\/webguide\/?page_id=12139"},"modified":"2025-02-04T15:32:32","modified_gmt":"2025-02-04T20:32:32","slug":"iframes","status":"publish","type":"page","link":"https:\/\/www.med.unc.edu\/webguide\/userguide\/iframes\/","title":{"rendered":"iFrames"},"content":{"rendered":"<p>An iFrame (Inline Frame) is an HTML element that is used to insert, or &#8220;embed,&#8221; content from one website into another. it provides an easy way to embed video or other content on your site without having to host the file in your site&#8217;s Media Library.<\/p>\n<p>Some of the common sites that our users pull, or embed, content from is <a href=\"https:\/\/www.med.unc.edu\/webguide\/userguide\/media\/video\/panopto\/\">Panopto<\/a>, YouTube, Google Maps, Facebook, Twitter, and <a href=\"https:\/\/maps.unc.edu\/\">UNC Campus Maps<\/a>.<\/p>\n<p>Most of these third-party sites give you the iFrame code that you need to add to your site. That code can often be found under a <strong>Share<\/strong> option. When you click the Share button you will likely be presented with several options. Select the <strong>Embed<\/strong> option to see the iFrame code.<\/p>\n<p><span class=\"imgBorderMed\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12155\" src=\"https:\/\/www.med.unc.edu\/webguide\/wp-content\/uploads\/sites\/419\/2021\/11\/share-options.png\" alt=\"Ways to share videos hosted in Panopto.\" width=\"269\" height=\"86\" \/><\/span><\/p>\n<p>Simply copy the &lt;iframe&gt;\u2026&lt;\/iframe&gt; code and paste it into your web page\/post.<\/p>\n<p><strong>Here&#8217;s the trick<\/strong>: In the code you just pasted, you have to change the alligator brackets (<span style=\"color: #c00;\"><strong>&lt;<\/strong><\/span> and <span style=\"color: #c00;\"><strong>&gt;<\/strong><\/span>) to the squared off brackets ( <span style=\"color: #c00;\"><strong>[<\/strong><\/span> and <span style=\"color: #c00;\"><strong>]<\/strong><\/span> ).<\/p>\n<hr  style=\"margin:40px 0\"class=\" rule-thin osc-rule\" \/>\n<h2>Example<\/h2>\n<p>Below is an example of how to modify the iframe code from Panopto. This code embeds a video about Accessible Web Colors on the page.<\/p>\n<p>Below is what the embed code looks like straight out of Panopto:<\/p>\n<p><code>&lt;iframe src=\"https:\/\/uncch.hosted.panopto.com\/Panopto\/Pages\/Embed.aspx?id=57624079-8af2-481d-be42-ace100e9b5ef&amp;autoplay=false&amp;offerviewer=true&amp;showtitle=true&amp;showbrand=false&amp;captions=true&amp;interactivity=all\" height=\"405\" width=\"720\" style=\"border: 1px solid #464646;\" allowfullscreen allow=\"autoplay\"&gt;&lt;\/iframe&gt; <\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Below is what the code will look like after the brackets have been changed:<\/p>\n<p><code>[iframe src=\"https:\/\/uncch.hosted.panopto.com\/Panopto\/Pages\/Embed.aspx?id=57624079-8af2-481d-be42-ace100e9b5ef&amp;autoplay=false&amp;offerviewer=true&amp;showtitle=true&amp;showbrand=false&amp;captions=true&amp;interactivity=all\" height=\"405\" width=\"720\" style=\"border: 1px solid #464646;\" allowfullscreen allow=\"autoplay\"][\/iframe]<\/code><\/p>\n<hr  style=\"margin:40px 0\"class=\" rule-thin osc-rule\" \/>\n<h2>A Title Is Required For Accessibility<\/h2>\n<p>Inline frames can introduce accessibility barriers, so use them sparingly.<\/p>\n<p>If you add an\u00a0&lt;iframe&gt;, you must include a\u00a0<strong>title attribute<\/strong>. This rule comes from the\u00a0<a href=\"https:\/\/www.w3.org\/WAI\/WCAG21\/quickref\/#name-role-value\" target=\"_blank\" rel=\"noopener\">Web Content Accessibility Guidelines (WCAG) success criterion 4.1.2 Name, Role, Value<\/a>.<\/p>\n<p>The title must summarize the visual content of the frame to help users of screen readers understand its purpose. Think of the title as the alternative text for the\u00a0&lt;iframe&gt;.<\/p>\n<p>Here&#8217;s an example of what the HTML can look like:<\/p>\n<p><code>&lt;iframe src=\"https:\/\/uncch.hosted.panopto.com\/Panopto\/Pages\/Embed.aspx?id=57624079-8af2-481d-be42-ace100e9b5ef&amp;autoplay=false&amp;offerviewer=true&amp;showtitle=true&amp;showbrand=false&amp;captions=true&amp;interactivity=all\" height=\"405\" width=\"720\" style=\"border: 1px solid #464646;\" allowfullscreen allow=\"autoplay\" <span class=\"code-highlight\">title=\"Accessible Web Colors, an accessibility training video for UNC School of Medicine website authors.\"<\/span> &gt;&lt;\/iframe&gt; <\/code><\/p>\n<p>In this example, the title includes the original name and extra context that describes its content.<\/p>\n<hr  style=\"margin:40px 0\"class=\" rule-thin osc-rule\" \/>\n<h2>Modifying the iFrame Size<\/h2>\n<p>Before copying the embed code from third-party sites, you are often given the option to define the width and height of your iframe. If not, you can usually change the dimensions of the video in the iframe code. Simply look for the width and height attributes. You can insert a fixed sizes in pixels such as <code class=\"inline\">height=\"640\" width=\"480\"<\/code>. Or, you can use a percentage based method to adjust the iFrame automatically such as <code class=\"inline\">width=\"100%\"<\/code>.<\/p>\n<hr  style=\"margin:40px 0\"class=\" rule-thin osc-rule\" \/>\n<h2>Alternatives to iFrames<\/h2>\n<p>In some cases the School of Medicine has shortcode or plugins that can be used as alternative ways to embed content.<\/p>\n<ul>\n<li><a style=\"color: #2a6496; text-decoration-line: underline; outline: 0px;\" href=\"https:\/\/www.med.unc.edu\/webguide\/userguide\/media\/video\/youtube\/\">Alternative way to embed YouTube videos<\/a><\/li>\n<\/ul>\n<hr  style=\"margin:40px 0\"class=\" rule-thin osc-rule\" \/>\n<h2>Related Resources<\/h2>\n<ul>\n<li>See the <a href=\"https:\/\/developers.facebook.com\/docs\/plugins\">Facebook Social Plugins<\/a> page for various ways of embedding Facebook content on your website. If you&#8217;re not sure what option to go with, look at the <a href=\"https:\/\/developers.facebook.com\/docs\/plugins\/page-plugin\/\">Page Plugin<\/a> option. This is what the <strong><a href=\"https:\/\/www.med.unc.edu\/htcenter\">HT Center<\/a><\/strong> uses on their home page to display their Facebook feed.<\/li>\n<li><a href=\"https:\/\/www.med.unc.edu\/webguide\/userguide\/styling-content\/iframes\/campus-map\/\">How to embed a UNC Campus Map<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An iFrame (Inline Frame) is an HTML element that is used to insert, or &#8220;embed,&#8221; content from one website into another. it provides an easy way to embed video or other content on your site without having to host the file in your site&#8217;s Media Library. Some of the common sites that our users pull, &hellip; <a href=\"https:\/\/www.med.unc.edu\/webguide\/userguide\/iframes\/\" aria-label=\"Read more about iFrames\">Read more<\/a><\/p>\n","protected":false},"author":3206,"featured_media":0,"parent":2168,"menu_order":21,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"layout":"","cellInformation":"","apiCallInformation":"","footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-12139","page","type-page","status-publish","hentry","odd"],"acf":[],"_links_to":[],"_links_to_target":[],"_links":{"self":[{"href":"https:\/\/www.med.unc.edu\/webguide\/wp-json\/wp\/v2\/pages\/12139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.med.unc.edu\/webguide\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.med.unc.edu\/webguide\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.med.unc.edu\/webguide\/wp-json\/wp\/v2\/users\/3206"}],"replies":[{"embeddable":true,"href":"https:\/\/www.med.unc.edu\/webguide\/wp-json\/wp\/v2\/comments?post=12139"}],"version-history":[{"count":0,"href":"https:\/\/www.med.unc.edu\/webguide\/wp-json\/wp\/v2\/pages\/12139\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.med.unc.edu\/webguide\/wp-json\/wp\/v2\/pages\/2168"}],"wp:attachment":[{"href":"https:\/\/www.med.unc.edu\/webguide\/wp-json\/wp\/v2\/media?parent=12139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}