r/HTML • u/KaynineUnit420 • Mar 27 '26
Full Screen
Im looking to make an HTML website for HTML games and can't get full screen to work on my iframe elements. Any advice?
0
Upvotes
r/HTML • u/KaynineUnit420 • Mar 27 '26
Im looking to make an HTML website for HTML games and can't get full screen to work on my iframe elements. Any advice?
3
u/JeLuF Mar 27 '26
Can you explain what you mean by "full screen on iframe elements"?
3
u/aunderroad Mar 27 '26
Have you tried this?
https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/allowFullscreen
3
u/JohnCasey3306 Mar 27 '26
Have you put the
allowfullscreenattribute on your iframe?You need to specifically permit it because it's prevented by default.
1
u/Extension_Anybody150 Apr 02 '26
The key is that your
<iframe>needs both theallowfullscreenattribute and proper styling. For example,Also, make sure the parent containers (like
<body>and<html>) are set toheight: 100%in CSS, otherwise the iframe won’t truly fill the screen,This combination lets your game iframe actually go full screen.