meta_viewport: Viewport Meta Tag

View source: R/viewport.R

meta_viewportR Documentation

Viewport Meta Tag

Description

Create or add a viewport meta tag.

Usage

meta_viewport(
  .meta = meta(),
  width = "device-width",
  initial_scale = "1",
  orientation = c("auto", "portrait", "landscape"),
  min_width = NULL,
  max_width = NULL,
  height = NULL,
  min_height = NULL,
  max_height = NULL,
  minimum_scale = NULL,
  maximum_scale = NULL,
  user_scalable = NULL,
  ...
)

Arguments

.meta

A meta object created by meta() or as_meta(), or returned by a ⁠meta_*()⁠ object.

width

Sets the width of initial viewport. width sets min_width and max_width and may contain two values; for example, the following are equivalent: "300px 500px" or c("300px", "500px")). The values may be a number with units, a percentage, or "device-width". Pixels are assumed if no units are provided.

initial_scale

Initial scale

orientation

One of "auto", "portrait", "landscape".

min_width, max_width

Minimum and maximum initial viewport width. See width for more information. width is ignored if min_width or max_width are set.

height, min_height, max_height

Sets height of initial viewport. Follows the same conventions as width, min_width, and max_width.

minimum_scale

Minimum scale

maximum_scale

Maximum scale

user_scalable

User scalable

...

Additional name/value pairs

Value

A meta object, or a set of ⁠<meta>⁠ HTML tags inside an HTML ⁠<head>⁠ tag. For use in rmarkdown::html_document(), shiny::runApp(), or other HTML locations.

References

MDN: Viewport Meta Tag,

See Also

Other meta: meta_apple_itunes_app(), meta_apple_web_app(), meta_general(), meta_geo(), meta_google_scholar(), meta_name(), meta_social(), meta_tag(), meta()

Examples

meta() %>%
  meta_viewport()

meta() %>%
  meta_viewport(orientation = NULL)

meta() %>%
  meta_viewport(maximum_scale = 1)


metathis documentation built on July 26, 2023, 5:49 p.m.