rstudio / htmltools

Tools for HTML generation and output
https://rstudio.github.io/htmltools/
213 stars 67 forks source link

Fill containers/items can spill out into their parent's margin #400

Closed cpsievert closed 10 months ago

cpsievert commented 10 months ago

Currently both bindFillRole(x, item = TRUE) and/or bindFillRole(x, container = TRUE) adds width:100% to x, which means that, if the parent of x has a margin set, x will be larger than it's parent, which is problematic. Fortunately, I don't think we need the width:100% .

For a minimal reprex, notice how the inner-most div spills out into the parent margin.

library(htmltools)
library(bslib)

page_fillable(
  div(
    as_fill_carrier(),
    class = "m-3",
    div(
      as_fill_item(),
      class = "border border-2"
    ),
  )
)