Pricing Blog

How to avoid native HTML resize behaviour overwriting my style variables?

  • mvvdv-1387973890739015793

    MVvdV

    1 month ago

    Im using style variables to keep track of and set the dimensions of a div. However, the browser native css resize that i use writes it's own width and height style properties that override my own. how can i avoid this?
    1387973890957115463-Screenshot_2025-06-27_at_11.44.14.png
  • lucasg-1387984817404121320

    Lucas G

    1 month ago

    A browser does not do that on its own
  • Those seem like inline styles
  • mvvdv-1388002092496588800

    MVvdV

    1 month ago

    they are not present before the 'resize' occurs and i do not have a function that attaches these styles to the element, so if the native resize behaviour does not do this where does it come from.
  • mvvdv-1388003722709438705

    MVvdV

    1 month ago

    the style variables are set inside the component, and the 'resize' occurs on the component instance, is that the issue? is it applying the styles to the instance after resize? how do i avoid that?
  • andreasmoller-1388007777212825700

    Andreas Møller

    1 month ago

    Are you using any third party JavaScript?
  • mvvdv-1388010203437600778

    MVvdV

    1 month ago

    none, all nordcraft baby 😎
  • andreasmoller-1388015474226364500

    Andreas Møller

    1 month ago

    Can you share the preview site?
  • mvvdv-1388017516705611816

    MVvdV

    1 month ago

    editing a new branch trying out different things but the issue is present there
  • lucasg-1388024039607500861

    Lucas G

    1 month ago

    It doesn't seem like those styles are being properly set
  • --height is a variable, not a property
  • --height: fit-content isn't actually setting the height property
  • The height property is hard-coded to 346px in that screenshot but it isn't actually being set by the variable
  • It would read height: var(--height) otherwise
  • Make sure you are correctly setting the height property with the variable
  • mvvdv-1388024767654793289

    MVvdV

    1 month ago

    Its a style variable set in the component which is tied to the height property. It works fine when I set a value to it.
  • It also work properly before I use resize
  • lucasg-1388025259650711672

    Lucas G

    1 month ago

    Sorry I just checked the link you sent
  • All the values seem to be updating correctly
  • And the windows properly resize
  • lucasg-1388025699578810389

    Lucas G

    1 month ago

    What is the issue exactly?
  • I see the variables updating then when dragging stops width/height are updated
  • It's a cool demo btw
    🙌1
  • mvvdv-1388036144024780941

    MVvdV

    1 month ago

    So the issue is the css resize adds the overwrite values for width and height so after resize I have no control over them. Especially if I minimise a window
  • mvvdv-1388038607557759066

    MVvdV

    1 month ago

    I was hoping to reveal it to the community when i was done, but I'm glad you like it
  • mvvdv-1388039706574454786

    MVvdV

    1 month ago

    thought i'd highlight the issue in this vid
  • plusmin-1388093564461781082

    Armand

    1 month ago

    Weird indeed. How does it behave in the editor?

    Very cool project and excellent project name lol!
  • andreasmoller-1388118200448975012

    Andreas Møller

    1 month ago

    Ah. Ok I thought you meant it set the --height and --width css variables
  • I think the only way to avoid that is to no use the resize property
  • lucasg-1388153895737364500

    Lucas G

    1 month ago

    Hmm on the link you sent me it behaves correctly. The 'ghost' parent div stays because the height variable gets set to fit-contentpx