Description Usage Arguments See Also Examples
Utility function to change a tag element's width. Widths are specified relative to the font size of page (browser default is 16px), relative to their parent element (i.e. 1/2 the width of their parent), or relative to the element's content.
1  | width(tag, size)
 | 
tag | 
 A tag element.  | 
size | 
 A character string or number specifying the width of the tag element. Possible values: An integer between 1 and 20, in which case the width of the element is relative to the font size of the page. 
 
  | 
Other design utilities: 
active(),
affix(),
background(),
border(),
display(),
float(),
font(),
height(),
padding(),
scroll(),
shadow()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  | ### Numeric `size` values
# When specifying a numeric value the width of the element is relative to the
# default font size of the page.
div(
  lapply(
    1:20,
    width,
    tag = div() %>%
      border("black") %>%
      height(4)
  )
) %>%
  flex(
    direction = "column",
    justify = "between"
  )
### Fractional `size` values
# When specifying width as a fraction the element's width is a percentage of
# its parent's width.
div() %>%
  margin(b = 3) %>%
  background("red") %>%
  height(5) %>%
  width("1/3")  # <-
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.