Search Unity

Resizing canvas without changing width/height in HTML

Discussion in 'Web' started by ctalk, Jul 12, 2017.

  1. ctalk

    ctalk

    Joined:
    Apr 21, 2017
    Posts:
    12
    I am trying to resize the canvas in html by NOT modifying the width and height of the gameContainer div tag which is:
    <div id="gameContainer" style="width: 720px; height: 1280px; margin: auto"></div>

    I set the scale of the gameContainer div to 0.5 but then the touches don't work properly. Did it this way
    <div id="gameContainer" style="width: 720px; height: 1280px; transform: scale(0.5); transform-origin: 0 0; margin: auto"></div>

    I tried setting the width and height of the body tag, but that doesn't seem to be working as it looks like body width and height are being override by the gameContainer div. Can anyone help out with this? Thanks!
     
  2. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648