an HTML attribute for the iframe tag
  1. Welcome
  2. iframe
  3. YouTube
  4. Examples
  5. Errors
  6. Anecdotes
  7. Questions (14)


Posted by William on 2016-08-01 00:43:10


As soon as I wrap the I-frame in a div (to centre the video) the full screen becomes disabled. Is there an easy way to overcome this?

<div style="text-align: center">
** iframe inserted here **


Posted by Leo on 2016-08-12 23:04:36

The fullscreen button should not get disabled when it is contained in a div, even if the div has the text-align attribute. Can you post the complete code with the iframe html?

Posted by William on 2016-08-22 16:00:20

Hi Leo, thanks for reply. It happens with any standard iframe e.g. the YouTube video below. (I've replaced the h-t-t-p-s with ***** as this website doesn't allow those letters to be posted.)

Even if this html code was on a bare page by itself the problem seems impossible to overcome. Wrapped in a div, the full screen is disabled. Remove the div and the full screen becomes accessible again. It's maddening!

<div style="text-align: center">
<iframe width="420" height="315" src="*****://" frameborder="0" allowfullscreen></iframe>

Posted by Stefan on 2020-01-29 20:29:33

I tested out your code in webmaker and it worked fine, I would select the video element in the dev console, then run elm.requestFullscreen() in the console.

elm = your element, either referenced with $0 if you select it in dev console or you can do querySelector()

Then see what error gets thrown.

Answer this Question


Back to All Questions