Skip to main content

New answers tagged

0 votes

Canvas is stretched when using CSS but normal with `width` & `height` attributes

Existing answers explain the issue but offer rather obtuse approaches to actually set the width and height. Here's how to set a non-stretch width/height in the most direct manner: const canvas = ...
ggorlen's user avatar
  • 59.9k
0 votes

How can I get browser scrollbar width?

If you truly want the scrollbar width here is a modern CSS only method: html { overflow-x: clip; container-type: inline-size; --scrollbar-width: calc(100vw - 100cqw); } The beauty of this ...
WPExplorer's user avatar

Top 50 recent answers are included