Home HTML Attributes playsinline HTML playsinline Attribute Definition
Definition and Usage The playsinline boolean attribute on <video> hints that the video should play in the page layout on mobile — especially important on iOS Safari, which historically entered fullscreen without it.
Combine with controls , muted , and autoplay when you need muted autoplay inline (common for hero loops).
Critical for iOS inline playback. Without playsinline, many iOS versions force fullscreen when playback starts.
Autoplay still has rules. Browsers often require muted (or user gesture) for autoplay even with playsinline.
Syntax
HTML Syntax Boolean attribute: presence means true. Empty value or the name alone both enable inline playback intent.
Values
Attribute Values Value Description Try it (boolean)Present = prefer inline playback on mobile Try it
Try it
Live Preview A sample video with playsinline and controls. Test on a phone for the real iOS difference.
Code
HTML Examples 1. Inline video 2. Muted autoplay 3. With poster Example 1 — Video with playsinline Mark the video so mobile browsers keep it in-page.
<video controls playsinline width="480">
<source src="/video/count.mp4" type="video/mp4">
</video> How It Works Add playsinline on the video element.Keep controls (or custom UI) for play/pause.Test on iOS Safari where the attribute matters most.Provide a source the browser can play.Example 2 — Muted Autoplay Loop Hero background videos usually need muted + playsinline + autoplay.
<video autoplay muted playsinline loop width="640">
<source src="/video/count.mp4" type="video/mp4">
</video> Pattern: autoplay muted playsinline loop for background motion.
How It Works muted is usually required for autoplay.playsinline keeps playback in layout on iOS.loop for continuous hero motion.Offer a pause control for accessibility when possible.Example 3 — Poster Before Play Show a still frame until the user starts playback.
<video controls playsinline poster="/images/codetofun-logo.png" width="480">
<source src="/video/count.mp4" type="video/mp4">
</video> How It Works poster shows before the first frame.playsinline for in-page mobile play.controls for native UI.See the poster attribute for more detail. Edge Cases & Pitfalls playsinline is a hint — OS policies and autoplay rules still apply.
ios iOS is the main reason Desktop browsers already play inline; mobile Safari is the historical pain point.
autoplay Muted for autoplay playsinline alone does not bypass autoplay restrictions.
webkit Legacy webkit-playsinline Very old iOS used a prefixed attribute; modern Safari uses playsinline.
a11y Motion sensitivity Avoid forced looping motion without a way to pause.
Compatibility
Browser Support playsinline is an HTML attribute for browsers. It is not a Node.js, Deno, or Bun API.
✓ Widely available
playsinline Supported across modern mobile and desktop browsers; essential for iOS inline video.
95% Global support (approx.)
Google Chrome Yes
Full support
Mozilla Firefox Yes
Full support
Apple Safari Yes
Full support
Microsoft Edge Yes
Full support
Opera Yes
Full support
Samsung Internet Yes
Full support
Internet Explorer No support
Not supported playsinline Widely supported
Bottom line: Always set playsinline on mobile-facing video players and muted autoplay heroes.
Remember
Key Takeaways Role: prefer in-page video playback on mobile.
Element: video (boolean attribute).
Hero loops: autoplay + muted + playsinline.
Test on iOS where fullscreen was the default.
One line: playsinline keeps video in the page on mobile — especially iOS.
Frequently Asked Questions What does playsinline do? It tells the browser to prefer playing the video inline in the page, especially on iOS where fullscreen was historically forced.
Is playsinline only for iOS? It matters most on iOS Safari, but it is valid HTML for video everywhere.
Does it enable autoplay? No. Autoplay still needs muted (or a user gesture) in most browsers.
Is it a boolean attribute? Yes. Presence enables the intent; omit it when you do not want the hint.
Do I still need controls? Usually yes for user-started playback, unless you build custom controls.
What about webkit-playsinline? That was a legacy prefixed form for older iOS. Use playsinline on modern sites.
Next: popover Build top-layer overlays with the Popover API (auto, manual, hint).
popover tutorial → CODETOFUN NEWS
Stay Ahead in Tech Get the latest IT news, programming updates, and technology trends directly on your phone.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
8 people found this page helpful
Helpful Share Copy link Suggestion