繁体中文
设为首页
加入收藏

推荐

公告

推荐文章
· CSS样式 14个高级技巧精选
· 一行代码杜绝iframe挂马
· css如何控制页面居中
· 与表格边框有关的CSS语法
· 多个CSS样式表争夺特定选...
· XHTML入门学习教程:框架...
· DIV+CSS布局实例:各种2栏...
· 左中右3栏布局中最先显示...
· 最小高度100%页脚保持在...
· CSS初级入门(1):整体布...
热点文章
广告

当前位置:网络首页 >> 网页制作 >> html/css >> 使用 CSS 创建固定宽度的布局

使用 CSS 创建固定宽度的布局 (3)

2008-01-08 09:29:43  作者:  来源:互联网  浏览次数:37  文字大小:【】【】【
简介:我最近的几篇专栏文章讨论了使用 XHTML 和 CSS 实现两列或三列页面布局的各个方面。到目前为止,所有例子都使用流式布局(也就是布局会自动扩展和适应浏览器窗口的宽度)。现在是时候考虑另外一种主要的页面布局 ...
关键字:宽度 布局

下面是将页面设计为固定宽度布局的 CSS 代码。

以下是引用片段:
body {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    margin: 0px;
    padding: 0px;
}
h2,h3 {
    margin-top: 0px;
    padding-top: 0px;
}
div#head {
    position: absolute;
    width:750px;
    height:100px;
    left:0px;
    top: 0px;
    background-color: #FFFF66;
}
div#columns {
    position: relative;
    width: 750px;
    top: 100px;
    background-color: #CCCCCC;
}
div#side1 {
    position:absolute;
    width:150px;
    top: 0px;
    left:0px;
    background-color: #FF6666;
}
div#content {
    position: relative;
    width: 450px;
    top: 0px;
    left: 150px;
    background-color: #999999;
}
div#side2 {
    position:absolute;
    width:150px;
    top: 0px;
    left: 600px;
    background-color: #00FF66;
}
div#foot {
    position: relative;
    width: 750px;
    clear: both;
    margin-top: 100px;
    background-color: #99FFFF;
}

 

[1] [2] [3] [4] [5]


相关文章