NW.js Why webview tag not fill window layout?

Viewed 116

NWJS Version :0.50.3 Operating System :Windows 10

I use tag <webview> with Google to source. It rendered, but webview not fill all window.

My index.html code:

<!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>

My package.json code:

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


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

This is just a normal CSS thing. height: 100% doesn't mean "100% of the page" it means "100% of the parent's height"`. And in this case, the parent's height is based on the child's content.

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