网页自动满屏实现代码

所属分类: 网页制作 / CSS 阅读数: 1152
收藏 0 赞 0 分享
<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:新宋体; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"\@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"\@新宋体"; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:.5gd; mso-para-margin-left:0cm; mso-para-margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; text-indent:10.0pt; mso-char-indent-count:2.0; mso-pagination:none; font-size:12.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:宋体; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:12.0pt; mso-ansi-font-size:12.0pt; mso-bidi-font-size:12.0pt; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:0cm; margin-bottom:.0001pt; mso-para-margin-bottom:.5gd; mso-para-margin-bottom:.0001pt; text-align:center; text-indent:10.0pt; mso-char-indent-count:2.0;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} -->
网页自动满屏
以前可以搞个<table>,然后设它的height=”100%”,这样整个表格就充满了页面,再将内容放在这表格内,搞定。可是不知从什么时候开始,突然发现这个属性失效了。
跟头部
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
这句有点儿关系。去掉也可以自动满屏,窗口有多大,window.document.body.offsetHeight就有多大。
保留这个头部,稍加变通,也可以满屏。
方法是在最外层加个DIV,如下:
<div id="divTest" style="width:100%;height:100%;position:absolute;">
注意这个;position:absolute; 一定要有,否则也不起作用。这个DIV就作为整个页面的容器。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body onload="LoadTabPage();">
<div id="divTest" style="width:100%;height:100%;position:absolute;">
……
</div>
</body> </html>
更多精彩内容其他人还在看

CSS圆角边框制作指南与实例

这篇文章主要介绍了CSS圆角边框制作指南与实例,这里突出讲解了以纯代码实现的小圆角 来消灭锯齿的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

css实现移动端图片文字水平居中

这篇文章主要为大家详细介绍了css实现移动端图片文字水平居中的方法,如何实现图片以及文字的整体水平居中,本文为大家提供两种解决办法,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

Div+CSS对HTML的table表格定位用法实例

这篇文章主要介绍了Div+CSS对HTML的table表格定位用法实例,文中讲到了CSS的定位差异问题需要的朋友可以参考下
收藏 0 赞 0 分享

使用div+CSS将页脚始终控制在页面最下方的方法

这篇文章主要介绍了使用div+CSS将页脚始终控制在页面最下方的方法,文中介绍了设置container以及使用绝对定位两种方法来解决,需要的朋友可以参考下
收藏 0 赞 0 分享

你值得拥有的CSS下拉菜单效果

这篇文章主要介绍了你值得拥有的多种CSS下拉菜单效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

CSS利用伪元素实现导航栏斜线分隔

这篇文章主要介绍了CSS利用伪元素实现导航栏斜线分隔的相关资料
收藏 0 赞 0 分享

纯CSS3打造属于自己的“小黄人”

这篇文章主要为大家详细介绍了纯CSS3打造属于自己的“小黄人”的相关代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

浅谈各种浏览器下的CSS Hack兼容性写法

这篇文章主要介绍了各种浏览器下的CSS Hack兼容性写法,CSS Hack大致可以分为内部Hack和选择器Hack以及HTML头部引用Hack,需要的朋友可以参考下
收藏 0 赞 0 分享

学习DIV+CSS网页布局之一列布局

学习DIV+CSS网页布局中的一列布局,本文为大家分享的是DIV+CSS网页布局教程的第一篇,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

学习DIV+CSS网页布局之两列布局

学习DIV+CSS网页布局中的两列布局,本文为大家分享的是DIV+CSS网页布局教程的第二篇,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享
查看更多