Version: 2.0 |

MetaViewport

in namespace DotVVM.Framework.Controls.Bootstrap4

Renders the HTML meta viewport element.

Properties

Name Type Description Notes Default Value
InitialScale String Gets or sets the initial-scale parameter value(initial zoom level).
attribute
inner element
static value
bindable
default
1
IsUserScalable Boolean Gets or sets the user-scalable parameter value which controls if user can zoom in on mobile device.
attribute
inner element
static value
bindable
default
True
MaximumScale String Gets or sets the maximum-scale parameter value.
attribute
inner element
static value
bindable
default
Width String Gets or sets the width parameter value with default set to use width of mobilde device(device-width).
attribute
inner element
static value
bindable
default
device-width

Events

Name Type Description

Usage & Scenarios

Renders the HTML <meta name="viewport" ... /> element. This element ensures proper rendering and touch zooming on mobile devices.

See details on https://getbootstrap.com/docs/4.1/getting-started/introduction/#responsive-meta-tag.

HTML Rendered by the Control

Sample 1: MetaViewport

Place the control inside the head element. It uses Bootstrap API to control zooming and presentation on mobile devices.

The MetaViewport control has the Width property which sets the width of the page.

The InitialScale property is used to set initial zoom level which is applied when the page is first loaded. The MaximumScale property defines maximum zoom level the user can set.

It is also possible to disable zooming at all with the IsUserScalable property.

<!-- Default meta viewport -->
<bs:MetaViewport/>

<!-- Custom meta viewport -->
<bs:MetaViewport Width="320" InitialScale="2" MaximumScale="4" />

<!-- Meta viewport with disabled user scaling -->
<bs:MetaViewport IsUserScalable="false" />

Suggestions


Help & Contribute

The documentation is maintained on GitHub.
We'll be happy if you edit the page and create a pull request.

Send message