如何使div全屏? [英] How do I make a div full screen?

查看:119
本文介绍了如何使div全屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Flot 来绘制我的一些数据,我在想将是巨大的,使这个图形显示全屏(占据显示器上的全部空间)点击按钮。目前, div 如下:

I am using Flot to graph some of my data and I was thinking it would be great to make this graph appear fullscreen (occupy full space on the monitor) upon clicking on a button. Currently, my div is as follows:

<div id="placeholder" style="width:800px;height:600px"></div>

当然,style属性只用于测试。在实际设计过程中,我将把它移动到 CSS

Of course, the style attribute is only for testing. I will move this to CSS after during the actual design. Is there anyway I could make this div fullscreen and still preserve all event handling?

推荐答案

当你说全屏的时候,

您不能强迫用户进入全屏模式 F11 ;但是,您可以使用以下CSS

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%;}

这当然会假设你的div是< body> 标记。否则,除了上述代码之外,您还需要添加以下代码。

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;}

这篇关于如何使div全屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆