Skip to contents

The text_size() function adjusts the font size of a tag element.

Usage

text_size(x, size)

Arguments

x

A tag element or .style pronoun.

size

A number specifying a font size for the text. One of,

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

    The sizes follow the conventions of HTML heading tags, so 1 is the largest font and 6 the smallest.

Value

An object of the same type as x.

Examples


library(htmltools)

p(
  .style %>%
    text_size(1),
  "Largest size"
)
#> <p class="fs-1">Largest size</p>

p(
  .style %>%
    text_size(6),
  "Smallest size"
)
#> <p class="fs-6">Smallest size</p>