请问高手怎么用DIV+CSS布局出入图所示的效果,要求随窗口到小变化而布局不会乱。不要用frameset
3个回答
展开全部
<style type="text/css">
<!--
*{ margin:0; padding:0;}
#header { margin-bottom:5px; height:100px; background:#aaa;}
#sidebar { float:left; width:200px; height:500px; background:#ccc;}
#content { margin-left:205px !important; margin-left:202px; height:500px; background:#eee;}
-->
</style>
<div id="header">Header</div>
<div id="sidebar">sidebar</div>
<div id="content">左侧固定,右侧自适应宽度</div>
<!--
*{ margin:0; padding:0;}
#header { margin-bottom:5px; height:100px; background:#aaa;}
#sidebar { float:left; width:200px; height:500px; background:#ccc;}
#content { margin-left:205px !important; margin-left:202px; height:500px; background:#eee;}
-->
</style>
<div id="header">Header</div>
<div id="sidebar">sidebar</div>
<div id="content">左侧固定,右侧自适应宽度</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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
#box{width:980px; margin:0 auto;}
#head{border:#F00 1px solid; margin-bottom:10px;}
#left{float:left; border:#F00 1px solid; margin-right:10px; width:200px;}
#right{float:left;border:#F00 1px solid; width:766px;}
</style>
</head>
<body>
<div id="box">
<div id="head">1</div>
<div id="main">
<div id="left">2</div>
<div id="right">3</div>
</div>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
#box{width:980px; margin:0 auto;}
#head{border:#F00 1px solid; margin-bottom:10px;}
#left{float:left; border:#F00 1px solid; margin-right:10px; width:200px;}
#right{float:left;border:#F00 1px solid; width:766px;}
</style>
</head>
<body>
<div id="box">
<div id="head">1</div>
<div id="main">
<div id="left">2</div>
<div id="right">3</div>
</div>
</div>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个得用后台抓取窗口大小的数据
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询