search

Home  >  Q&A  >  body text

At what point in the parsing/rendering process is an HTML element assigned a box model?

Is it during the build process of CSSOM (default padding/border/margin may be applied to all nodes)?

P粉547420474P粉547420474445 days ago451

reply all(1)I'll reply

  • P粉983021177

    P粉9830211772024-02-27 00:46:54

    The

    element's box is (re)computed in the so-called "Update Layout" phase, which is currently specified* to occur (at least) in the next "Update Rendering" event loop step, in substep 14:

    But it can also be enforced synchronously when calling some getters.

    *While this is a recent addition to the specification, not all browsers strictly adhere to it, for example, I know from experience that Safari does not wait for the next "paint frame" to perform this layout update , but just some free time.

    reply
    0
  • Cancelreply