Skip to contents

The width_relative() function adjusts a tag element's width relative to its parent element's width.

Usage

width_relative(x, percent)

Arguments

x

A tag element or .style pronoun.

percent

A number specifying a percent. One of,

  • 25

  • 50

  • 75

  • 100

Value

An object of the same type as x.

Examples


library(htmltools)

div(
  .style %>%
    width_relative(25)
)
#> <div class="w-25"></div>

div(
  .style %>%
    width_relative(100)
)
#> <div class="w-100"></div>