博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用CSS 排版网页布局
阅读量:6150 次
发布时间:2019-06-21

本文共 4877 字,大约阅读时间需要 16 分钟。

代码如下:

<html>
<head>
<style type="text/css">
<!--
body {
margin:0px;
font-size:13px;
font-family:Arial;
}
#container{
position:relative;
width:100%;
}
#banner{
height:80px;
border:1px solid #000000;
text-align:center;
background-color:#a2d9ff;
padding:10px;
margin-bottom:2px;
}
#content{
float:left;
text-align:center;
padding-right:200px; /* 内容往回挤200px */
}
#links{
float:right;
width:200px;
border:1px solid #000000;
margin-left:-200px; /* 强行往左拉回200px */
text-align:center;
}
#footer{
clear:both; /* 不受float影响 */
text-align:center;
height:30px;
border:1px solid #000000;
}
-->
</style>
<title>CSS排版</title><body>
<div id="container">
<div id="banner">banner</div>
<div id="content">
<div class="blog">
<div class="date">date</div>
<div class="blogcontent">
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
content content content content content content content content content content<br>
</div>
</div>
<div class="others">others</div>
</div>
<div id="links">
<div class="calendarhead">links<br>links<br>links<br>links</div>
<div class="calendartable">links<br>links<br>links<br>links</div>
<div class="side">links<br>links<br>links<br>links</div>
<div class="syndicate">links<br>links<br>links<br>links</div>
<div class="friends">links<br>links<br>links<br>links</div>
</div>
<div id="footer">footer</div>
</div>
</body>
</html>

运行效果如下:

<html> <head> <style type="text/css"> <!-- body { margin:0px; font-size:13px; font-family:Arial; } #container{ position:relative; width:100%; } #banner{ height:80px; border:1px solid #000000; text-align:center; background-color:#a2d9ff; padding:10px; margin-bottom:2px; } #content{ float:left; text-align:center; padding-right:200px; /* 内容往回挤200px */ } #links{ float:right; width:200px; border:1px solid #000000; margin-left:-200px; /* 强行往左拉回200px */ text-align:center; } #footer{ clear:both; /* 不受float影响 */ text-align:center; height:30px; border:1px solid #000000; } --> </style> <title>CSS排版</title><body> <div id="container"> <div id="banner">banner</div> <div id="content"> <div class="blog"> <div class="date">date</div> <div class="blogcontent"> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> content content content content content content content content content content<br> </div> </div> <div class="others">others</div> </div> <div id="links"> <div class="calendarhead">links<br>links<br>links<br>links</div> <div class="calendartable">links<br>links<br>links<br>links</div> <div class="side">links<br>links<br>links<br>links</div> <div class="syndicate">links<br>links<br>links<br>links</div> <div class="friends">links<br>links<br>links<br>links</div> </div> <div id="footer">footer</div> </div> </body> </html>

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

本文转自钢钢博客园博客,原文链接:http://www.cnblogs.com/xugang/archive/2010/08/07/1794729.html,如需转载请自行联系原作者 

你可能感兴趣的文章
企业级负载平衡简介(转)
查看>>
ICCV2017 论文浏览记录
查看>>
科技巨头的交通争夺战
查看>>
Shell基础之-正则表达式
查看>>
JavaScript异步之Generator、async、await
查看>>
讲讲吸顶效果与react-sticky
查看>>
c++面向对象的一些问题1 0
查看>>
直播视频流技术名词
查看>>
IOC —— AOP
查看>>
比特币现金将出新招,推动比特币现金使用
查看>>
MS SQLSERVER通用存储过程分页
查看>>
60.使用Azure AI 自定义视觉服务实现物品识别Demo
查看>>
Oracle 冷备份
查看>>
jq漂亮实用的select,select选中后,显示对应内容
查看>>
C 函数sscanf()的用法
查看>>
python模块之hashlib: md5和sha算法
查看>>
解决ros建***能登录不能访问内网远程桌面的问题
查看>>
售前工程师的成长---一个老员工的经验之谈
查看>>
Get到的优秀博客网址
查看>>
【Git入门之四】操作项目
查看>>