Skip to content

Fit Screen

dvk-fit-screen scales a fixed design canvas into either the browser viewport or its host container.

Contain Mode

1280 x 720 design canvas

html
<dvk-fit-screen fit-target="host" width="1280" height="720" mode="contain" align="center center">
  <dvk-border-box-1>
    <section>Contain Mode</section>
  </dvk-border-box-1>
</dvk-fit-screen>

Props

NameTypeDefaultNotes
widthnumber1920Design canvas width.
heightnumber1080Design canvas height.
modecontain | cover | fill | scrollcontainScaling behavior.
alignstringcenter centerHorizontal and vertical alignment.
fit-targetviewport | hostviewportviewport makes a full-page dashboard shell; host follows the parent container.
auto-fullscreenbooleanfalseCompatibility flag only; fullscreen must use a user gesture.

Events

NameDetail
dvk-resize{ width, height, dpr, scale, scaleX, scaleY, offsetX, offsetY }
dvk-fullscreen-request{ ok, reason }

CSS Variables

NameMeaning
--dvk-scaleThe active uniform scale.
--dvk-scale-xX scale.
--dvk-scale-yY scale.
--dvk-viewport-widthObserved viewport width.
--dvk-viewport-heightObserved viewport height.

Parts

PartDescription
viewportOuter viewport wrapper.
canvasScaled design canvas.