【问题标题】:Set a webview view to window size将 webview 视图设置为窗口大小
【发布时间】:2019-04-06 23:29:25
【问题描述】:

我正在用 electron 制作一个网络浏览器,但我遇到了一个问题,即我在 webview 中打开的页面没有调整到窗口的大小并且超出了范围。

这是问题的图片:

如果有人知道如何帮助我,我将不胜感激。

【问题讨论】:

  • 你有 webview 的样式吗?喜欢#myWebview{ height: 100%; width: 100%; }
  • 您的 webview 中显示的示例是响应式的?
  • @pushkin 不,我没有任何样式。
  • @JonathanBrizio 我不明白你的问题,如果你能更好地解释它会非常有用。
  • 您链接的内容(网站)是否适应窗口大小? w3schools.com/html/html_responsive.asp

标签: node.js webview electron


【解决方案1】:

将此 CSS 添加到您的 window.html 页面:

/* make sure that the body fills the entire window */
body {
    width:100vw;
    height:100vh;
    margin:0px;
}

/* make sure that the webview element fills the entire body*/
webview {
    height:100%;
    width:100%;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-31
    • 2022-06-18
    • 1970-01-01
    • 1970-01-01
    • 2013-10-05
    • 1970-01-01
    • 2014-01-07
    • 2015-01-28
    相关资源
    最近更新 更多