Styling and layout of a webview


#1

I’m having problems getting a webview to behave like a normal DOM block element… floating, etc.

I see the ‘autosize’ property, but that’s not what I want really - I don’t want to be specifying a minimum size, I want it to be flexible and move out of the way when a search sidebar is unhidden.

There’s no .style on the webview element, either, so I can’t resize it from JavaScript.

What am I missing about the webview, conceptually?


The webview element and the dimensions of underlying object in shadow DOM
#2

Works for me:

document.getElementById('webview').setAttribute('style', 'display: inline-block; width: 1280px; height: 720px;');

Also works for me:

document.getElementById('webview').style.width = '200px';

#3

Thanks @OlsonDev. So there is a style attribute. Error 1 on my part.

Error 2 is that there was something in my CSS that was making the webview seem to ignore % widths. Digging into that, but doesn’t seem to be an electron issue.

Thanks again. I’m stressed-out and this was really helpful.