width: Width

Description Usage Arguments Examples

View source: R/width.R

Description

The ‘width() function adjusts a tag element’s width. Widths are specified relative the width of a parent element, an element's content, or the size of the browser window.

Usage

1
width(x, size, min = NULL, max = NULL)

Arguments

x

A tag element or .style pronoun.

size

One of 25, 50, 75, 100, "auto", or "viewport" specifying the width of the tag element.

If 25, 50, 75, 100, the element's width is a percentage of the width of the parent element must also be specified.

These percentages do not account for margins or padding and may cause an element to extend beyond its parent element.

If "auto", the element's width is determined by the browser. The browser will take into account the height, padding, margins, and border of the tag element's parent to keep the element from extending beyond its parent.

If "viewport", the element's height is determined by the size of the browser window.

min

One of 25, 50, 75, 100, or "viewport" specifying the minimum width of the tag element, defaults to NULL, in which case the argument is ignored.

See size for details.

max

One of 25, 50, 75, 100, or "viewport" specifying the maximum width of the tag element, defaults to NULL, in which case the argument is ignored.

See size for details.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(htmltools)

div(
  .style %>%
    width(c(xs = 100, md = 50)) %>%
    margin(c(xs = 2, md = "auto")),
  "In id erat non orci commodo lobortis.",
  "Suspendisse potenti.",
  "Nam euismod tellus id erat."
)

cascadess documentation built on Jan. 13, 2021, 5:10 p.m.