Learn R Programming

cascadess (version 0.1.0)

width: Width

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

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

Run this code
# NOT RUN {
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."
)

# }

Run the code above in your browser using DataLab