How Does the SMIL Fill Attribute Work?
In Synchronized Multimedia Integration Language (SMIL), the
fill attribute dictates whether an element remains visible
or active after its scheduled playback duration ends. By defining
persistence states such as freeze, remove,
hold, transition, or auto,
developers can control whether visual and auditory elements vanish
immediately upon completion or linger on screen to maintain visual
continuity across multi-track presentations.
Core Purpose of the Fill Attribute
During timed multimedia presentations, media elements such as audio tracks, video clips, text captions, and animations operate on distinct timelines. Once an element reaches the end of its active duration, the rendering engine must know how to handle the remaining screen space.
Without explicit instructions, completed elements might abruptly
disappear, causing visual flickering or breaking synchronization with
companion media. The fill attribute resolves this by
defining post-playback behavior, allowing elements to extend their
visual presence without extending their active playback clock.
Key Attribute Values and Behaviors
SMIL defines several explicit values for the fill
attribute to accommodate different synchronization scenarios:
remove: The default behavior for most media elements. As soon as the active duration expires, the element is removed from the presentation space and is no longer rendered.freeze: The element's final state or terminal frame is locked on the display for the remainder of the parent time container's duration. The element ceases active playback, but its final rendered frame remains visible.hold: Primarily used in advanced SMIL profiles,holdpreserves the element at its final position and keeps its intrinsic layout space reserved, preventing adjacent elements from collapsing into its vacated area.transition: Specifies that the element remains visible only if it is participating in an active visual transition with an incoming element, vanishing once the transition completes.auto: Instructs the player to defer to the default fill semantics defined by the surrounding container or profile specifications.
Practical Use Cases
Controlling media persistence is critical in synchronized layouts and vector graphics:
Slide-Based Presentations
In sequential presentations, title cards and background graphics
often need to stay visible while voiceovers or subsequent bullet points
load. Setting fill="freeze" on introductory slides ensures
the context remains on screen until the entire sequence transitions.
SVG Animations
SVG inherits SMIL timing models for vector manipulation (such as
<animate> and <animateTransform>).
Applying fill="freeze" allows an animated graphic—such as a
moving icon or expanding progress bar—to retain its transformed end
state rather than instantly snapping back to its original
dimensions.
Multi-Track Synchronization
When audio tracks finish earlier than accompanying video or background graphics, explicit fill rules ensure that dependent visual layers do not unmount prematurely, preserving the overall visual integrity of the layout.