Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/422.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 适合页面。高度问题_Javascript_Html_Css - Fatal编程技术网

Javascript 适合页面。高度问题

Javascript 适合页面。高度问题,javascript,html,css,Javascript,Html,Css,我有一个脚本,它是把摄像机放在全屏上。 我制作了一个脚本,创建一个表: document.getElementById('cameras_content').innerHTML += ('<table height="50%" width="50%" style="float: left;">' + '<tr>' + '<td><img id="topImage'+ m +'" width="100%"

我有一个脚本,它是把摄像机放在全屏上。 我制作了一个脚本,创建一个表:

document.getElementById('cameras_content').innerHTML +=
    ('<table height="50%" width="50%" style="float: left;">' + 
        '<tr>' +
            '<td><img id="topImage'+ m +'" width="100%" height="100%"></img></td>' +
        '</tr>' +                                                   
    '</table>');    

为了在HTML页面中使用高度百分比,您需要更改页面自身大小的方式。(通常,主体会调整自身大小以容纳其内容,而不是填充浏览器窗口)

为此,请在
标记中添加以下内容:

<style type="text/css">
  html{
    height: 100%;
  }
  body {
    min-height: 100%;
  }

  /* this part is optional, but makes scrollbars etc easier to handle */
  body, html{
     padding:0;
  }
</style>

html{
身高:100%;
}
身体{
最小高度:100%;
}
/*这部分是可选的,但使滚动条等更容易处理*/
正文,html{
填充:0;
}

完成此操作后,可以在元素上使用百分比高度。

没有帮助。身高仍然不合适。。添加了我的全屏脚本。请求全屏与获取垂直适合的元素完全不同。。。
<style type="text/css">
  html{
    height: 100%;
  }
  body {
    min-height: 100%;
  }

  /* this part is optional, but makes scrollbars etc easier to handle */
  body, html{
     padding:0;
  }
</style>