HTML布局动态随窗口变化
2014-03-12 22:07
183 查看
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<title>HTML布局随窗口动态变化</title>
</head>
<script>
$(function(){
resizeGolbalBody();
$(window).resize(function(){
resizeGolbalBody();
});
});
function resizeGolbalBody(){
var width=window.innerWidth-20;
var height=window.innerHeight-20;
width<1388?width=1388:width=width;
height<900?height=900:height=height;
$("#container").css({width:width+"px",height:height+"px"});
}
</script>
<style>
#container{
background-color:#09F;
box-shadow:0 0 5px #000;
border-radius:10px;
text-align:center;
margin:0px auto;
}
#header{
border:none;
width:100%;
height:10%;
float:left;
}
#main{
width:100%;
height:80%;
clear:both;
}
#m_left{
background-color:#CCC;
width:15%;
height:auto;
float:left;
margin-left:4px;
}
#m_body{
background-color:#FFF;
width:84%;
height:100%;
float:left;
margin-left:4px;
}
#footer{
width:100%;
height:10%;
float:left;
}
</style>
<body>
<div id="container">
<div id="header">
<p>前端技术</p>
</div>
<div id="main">
<div id="m_left">
<ul>
<li><a href="#">系统工程</a></li>
<li><a href="#">外国语言</a></li>
<li><a href="#">科学技术</a></li>
</ul>
</div>
<div id="m_body">
<iframe src="http://www.51cto.com" width="100%" height="100%" scrolling="no" frameborder="0"></iframe>
</div>
</div>
<div id="footer">
<p>版本所有 周正德——前端技术</p>
</div>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<title>HTML布局随窗口动态变化</title>
</head>
<script>
$(function(){
resizeGolbalBody();
$(window).resize(function(){
resizeGolbalBody();
});
});
function resizeGolbalBody(){
var width=window.innerWidth-20;
var height=window.innerHeight-20;
width<1388?width=1388:width=width;
height<900?height=900:height=height;
$("#container").css({width:width+"px",height:height+"px"});
}
</script>
<style>
#container{
background-color:#09F;
box-shadow:0 0 5px #000;
border-radius:10px;
text-align:center;
margin:0px auto;
}
#header{
border:none;
width:100%;
height:10%;
float:left;
}
#main{
width:100%;
height:80%;
clear:both;
}
#m_left{
background-color:#CCC;
width:15%;
height:auto;
float:left;
margin-left:4px;
}
#m_body{
background-color:#FFF;
width:84%;
height:100%;
float:left;
margin-left:4px;
}
#footer{
width:100%;
height:10%;
float:left;
}
</style>
<body>
<div id="container">
<div id="header">
<p>前端技术</p>
</div>
<div id="main">
<div id="m_left">
<ul>
<li><a href="#">系统工程</a></li>
<li><a href="#">外国语言</a></li>
<li><a href="#">科学技术</a></li>
</ul>
</div>
<div id="m_body">
<iframe src="http://www.51cto.com" width="100%" height="100%" scrolling="no" frameborder="0"></iframe>
</div>
</div>
<div id="footer">
<p>版本所有 周正德——前端技术</p>
</div>
</div>
</body>
</html>
相关文章推荐
- [html5入门-9]html布局中如何去掉a标签的下划线和防止标签颜色变化
- HTML动态漂浮窗口代码
- CSS3+HTML5特效8 - 顶部和右侧固定,左侧随窗口变化的布局
- django静态html中做动态变化
- 浅谈 Qt 布局管理器 如何让控件随着窗口变化
- CSS布局:div高度随窗口变化而变化
- CSS3+HTML5特效8 - 顶部和右侧固定,左侧随窗口变化的布局
- Qt动态布局,多个窗口使用同一个widget如何实现。
- 当窗口大小变化时,始终让底图居中--转载http://topic.csdn.net/t/20060824/16/4973302.html
- HTML 主流布局区别差异动态
- HTML/CSS编写一个三栏布局,左右200px,中间随窗口大小变动
- 浅谈 Qt 布局管理器 如何让控件随着窗口变化
- [置顶] html学习笔记,锚点,超链接,table布局,表头,h,sub,blockquote,ul,li,ol.dl,加入收藏,打印,弹出窗口
- WPF如何让控件随着窗口大小而变化,布局不乱
- jquery easyui 布局与动态打开窗口tabs
- html学习笔记,锚点,超链接,table布局,表头,h,sub,blockquote,ul,li,ol.dl,加入收藏,打印,弹出窗口
- 动态获取div的高度 随着窗口变化而变化
- 【CSS】三列布局(左右div固定宽度,中间div随浏览器窗口自适应变化宽度)
- Swing中窗口菜单动态变化的实现
- MFC对话框程序添加状态栏动态显示时间,随窗口大小变化