【问题标题】:NW.js Why webview tag not fill window layout?NW.js 为什么 webview 标签不填充窗口布局?
【发布时间】:2021-04-24 23:11:39
【问题描述】:

NWJS 版本:0.50.3 操作系统:Windows 10

我使用标签 <webview> 和 Google 来获取资源。它渲染了,但 webview 没有填满所有窗口。

我的 index.html 代码:

<!DOCTYPE html>
<html>
  <head>
    <title>Hello World!</title>
    <style>
        #foo {
          height:100%;
          width:100%;
          margin: 0;
        }
    </style>
  </head>
  <body>
    <webview id="foo" src="https://www.google.com/"></webview>
  </body>
</html>

我的 package.json 代码:

{
  "name": "helloworld",
  "main": "index.html"
}
```[enter image description here][1]


  [1]: https://i.stack.imgur.com/uxZi1.png

【问题讨论】:

    标签: node-webkit


    【解决方案1】:

    这只是一个普通的 CSS 东西。 height: 100% 并不表示“页面的 100%”,而是表示“父级高度的 100%”`。在这种情况下,父母的身高是基于孩子的内容。

    html,
    body,
    #foo {
        width: 100%;
        height: 100%;
        border: 0px;
        margin: 0px;
        padding: 0px;
        overflow: hidden;
    }
    

    【讨论】:

      猜你喜欢
      • 2013-09-16
      • 2017-05-05
      • 2015-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多