How do I make a div full screen?

Legend提出了一个问题:How do I make a div full screen?,或许与您遇到的问题类似。

回答者Patrick Robert Shea O'Connor给出了该问题的处理方式:

When you say "full-screen", do you mean like full-screen for the computer, or for taking up the entire space in the browser?

You can't force the user into full-screen F11; however, you can make your div full screen by using the following CSS

div {width: 100%; height: 100%;}

This will of course assume your div is child of the <body> tag. Otherwise, you'd need to add the following in addition to the above code.

div {position: absolute; top: 0; left: 0;}

希望本文对你有帮助,欢迎支持JavaScript中文网