Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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
HTML正文宽度超过监视器宽度,没有任何样式或内容?_Html_Width_Screen_Document - Fatal编程技术网

HTML正文宽度超过监视器宽度,没有任何样式或内容?

HTML正文宽度超过监视器宽度,没有任何样式或内容?,html,width,screen,document,Html,Width,Screen,Document,见下图: 这是绝对糟糕的,因为我需要一个像素精确的值来表示文档。很遗憾,所有值(document.body.scrollWidth、document.body.offsetWidth、document.documentElement.clientWidth、document.documentElement.scrollWidth、document.documentElement.offsetWidth)都显示了错误的值。我不知道发生了什么事。网站上没有样式和内容。我的屏幕是全高清(1920)

见下图:

这是绝对糟糕的,因为我需要一个像素精确的值来表示文档。很遗憾,所有值(document.body.scrollWidth、document.body.offsetWidth、document.documentElement.clientWidth、document.documentElement.scrollWidth、document.documentElement.offsetWidth)都显示了错误的值。我不知道发生了什么事。网站上没有样式和内容。我的屏幕是全高清(1920)


编辑:该错误似乎是特定于浏览器的。opera显示的是2170,chrome显示的是1920!opera是怎么回事?

我可以问你为什么需要文档宽度的像素精确值吗?因为我使用的是canvas和WebGL,如果我不知道画布的确切宽度,因此也不知道主体,图像会变得模糊。我只知道jQuery中的
$(window)。width()
非常可靠。。。