Electron: Positioning of Window Content


Sorry, don’t really know where to ask this, but I have a website in my electron window, not a local html file. Therefore, I can’t edit the css, but I want to reposition the content in the window (not individual elements, the whole thing). I packaged the app using Nativefier, and there is no css, so again, I can’t edit it. How do I do this? Any help would be appreciated.



I think your best bet is running a bit of JavaScript that sets the styles you want to add.


You can inject CSS into a window using the insertCSS method of WebContents.


@enlight Can you give me an example of what it would look like?



You just need to put that after the URL is loaded. The main issue you’ll have is trawling through Nativefier's Webpacked JS to find where to put it.