float: Float

Description Usage Arguments See Also Examples

View source: R/design.R

Description

Use float() to float an element to the left or right side of its parent element. A newspaper layout is a classic usage where an image is floated with text wrapped around.

Usage

1
float(tag, side)

Arguments

tag

A tag element.

side

A responsive argument. One of "left" or "right" specifying the side to float the element.

See Also

Other design utilities: active(), affix(), background(), border(), display(), font(), height(), padding(), scroll(), shadow(), width()

Examples

 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
### Newspaper layout

div(
  div() %>%
    width(5) %>%
    height(5) %>%
    margin(right = 2) %>%
    background("amber") %>%
    float("left"),
  p(
    "Fusce commodo. Nullam tempus. Nunc rutrum turpis sed pede.",
    "Phasellus lacus.  Cras placerat accumsan nulla.",
    "Fusce sagittis, libero non molestie mollis, ",
    "magna orci ultrices dolor, at vulputate neque nulla lacinia eros."
  ),
  p(
    "Nulla facilisis, risus a rhoncus fermentum, tellus tellus",
    "lacinia purus, et dictum nunc justo sit amet elit."
  ),
  p(
    "Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus.",
    "Aliquam posuere.",
    "Sed id ligula quis est convallis tempor."
  )
)

yonder documentation built on Jan. 11, 2020, 9:35 a.m.