DIV+CSS通用样式布局实例代码
前端  /  管理员 发布于 8年前   204
一下是一个非常简单易懂的通用样式布局,希望对于刚开始接触DIV+CSS的同学有帮助。先看效果图:
我们可以看出通常的页面布局有以下几个部分:头部、内容、底部,其中内容有左侧主显区和右侧边栏。下面贴出代码:
复制代码代码如下:
<!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=gbk" />
<title>DIV+CSS practice</title>
<link href="https:/css/css/common.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<!-- 头部 -->
<div id="head">
</div>
<!--END 头部 -->
<!-- 主容器 -->
<div id="container">
<!-- 左侧主显区 -->
<div id="content">
</div>
<!-- END 左侧主显区 -->
<!-- 右侧边栏 -->
<div id="side">
</div>
<!-- END 右侧边栏 -->
</div>
<!-- END 主容器 -->
<div class="clear"></div>
<!-- 底部 -->
<div id="foot">
</div>
<!-- END 底部 -->
</body>
</html>
common.css样式文件:
*{
margin:0;
padding:0;
}
body{
background-color:gray;
}
.clear{
clear:both;
}
/*head*/
#head{
background-color:blue;
height:150px;
}
/*container*/
#container{
background-color:red;
width:960px;
height:800px;
margin:20px auto;
}
/*content*/
#content{
background-color:yellow;
float:left;
width:685px;
height:100%;
}
/*side*/
#side{
background-color:green;
float:right;
width:255px;
height:100%;
}
/*foot*/
#foot{
background-color:white;
height:150px;
width:960px;
margin:20px auto;
}
大致布局很简单了,首先要有这个大局观,然后再完善其中的细节,学习PHP或者其他语言同样如此,首先要有一个思想,知道每一步做什么,怎么做,这样才能把知识灵活运用。
test1 在
opencode + Oh-my-openagent,我的第一个免费的ai编程智能体管家:Sisyphus中评论 test..122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..Zita 在
Google AI Studio升级全栈 vibe coding体验,可直接构建带登录和数据库的应用中评论 111222..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号
