title: How do I size an electron window's width based on the width of an HTML element inside it?
body: <p>I have an element in the HTML of the electron window and I don't know how wide the element will be. How can I set the minimum width of the electron <code>BrowserWindow</code> which was created in <code>main.js</code> to be equal to the width of said HTML element?</p>
  
  <p>I tried using <code>element.offsetWidth</code> in the <code>index.html</code> file to get the element's width and then using the below code in the same file to set the window's minimum size, but the size ended up being off somehow. I don't know why. It seems from some console output that it should be working.</p>
  
  <pre><code>var remote = require('electron').remote;
  var win = remote.getCurrentWindow();
  win.setMinimumSize(elementWidth, 400);
  </code></pre>
  
  <p>My guess is that my screen's pixel are not the same size as the CSS pixels, but I'm not really sure. Is there just a better way to do this altogether or am I missing something?</p>