Skip to contents

The vertical_alignment() function adjusts the inline position of inline, inline-block, and table cell elements. The utility may be used to adjust the vertical alignment of an image in a line of text or the contents of a table cell.

Usage

vertical_alignment(x, alignment)

Arguments

x

A tag element or .style pronoun.

alignment

A character string specifying an alignment. One of,

  • "baseline"

  • "top"

  • "middle"

  • "bottom"

  • "text-top"

  • "text-bottom"

Value

An object of the same type as x.

Examples


library(htmltools)

div(
  "Text",
  span("Above") %>%
    vertical_alignment("top"),
  span("Below") %>%
    vertical_alignment("bottom")
)
#> <div>
#>   Text
#>   <span class="align-top">Above</span>
#>   <span class="align-bottom">Below</span>
#> </div>