根据用户的屏幕尺寸设置div宽度 [英] setting div width according to the screen size of user
本文介绍了根据用户的屏幕尺寸设置div宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将div的宽度和高度设置为完全等于我的用户屏幕的大小.怎么做到呢.我应该使用jquery吗?如果是这样,怎么办?
I am trying to set the width and height of a div exactly equal to the size of my users screen. How can it be done. Should I use jquery ? If so, how ?
推荐答案
一些CSS呢? http://jsfiddle.net/TJGZU/
body, html { /* set size of body to full page and remove margins */
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
div { /* set div to full width and height */
width: 100%;
height: 100%;
}
这篇关于根据用户的屏幕尺寸设置div宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文