Worth setting `display: block` for canvas?

Description of the problem

I’ve just added <!DOCTYPE html> to my project and noticed that my page now has scroll bars, both vertical and horizontal. My understanding is that specifying this doctype changes the box model, so I was wondering if it’s worth changing the display style for the generated canvas explicitly to block in the renderer.

I’ve copied https://threejs.org/docs/#manual/introduction/Creating-a-scene over to here to illustrate. While doing so, I noticed that the base fiddle sets overflow: hidden so I can do something similar if adding it into the renderer is not something that you want to pursue.

Three.js version
  • Dev
  • r95
Browser
  • All of them
  • Chrome
  • Firefox
  • Safari
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Nada.

Author: Fantashit

1 thought on “Worth setting `display: block` for canvas?

  1. As you are aware, the bottom space is generated by inline-level-block which is the initial display of canvas for text-runs. then, it causes scrollbars.

    If you set block, then the descendants will be ignored. However, the CSS Specificity in style attributes is very high. I think it should be done in userland rather than done in the renderer.

    But worth changing the styles in examples.

Comments are closed.