我写的CSS(最基本的外框架)

 上中下,左中右,居中,这些布局方法是最基本的。
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" >
  3. <head>
  4.     <title>css基本布局方法</title>
  5.     <style type="text/css">
  6.         *
  7.         {
  8.             font-size:12px;
  9.             font-family:verdana;
  10.             margin:0px;/*--定义元素周围的空间*/
  11.             padding:0px;/*--定义元素边框与元素内容之间的空白*/
  12.         }
  13.         #body
  14.         {
  15.             position:relative;
  16.             width:85%;
  17.             margin:3px auto;/*上下,左右,这里的左右就是居中*/
  18.             height:100%;
  19.         }
  20.         #sidebar /*左边*/
  21.         {
  22.             position:absolute;
  23.             left:0;
  24.             top:0;
  25.             width:200px;
  26.         }
  27.         #right
  28.         {
  29.             width:240px;
  30.             position:absolute;
  31.             right:0;
  32.             top:0;
  33.         }
  34.         #center
  35.         {
  36.             margin:0 241px 0 201px;/*上右下左*/
  37.         }
  38.         #header,#footer
  39.         {
  40.             width:85%;
  41.             margin:0 auto;/*由浏览器设置*/
  42.             height:50px;
  43.         }
  44.         #sidebar,#right,#center,#header,#footer{border:solid 1px #000;}
  45.         #sidebar,#right,#center{height:780px;}
  46.     </style>
  47. </head>
  48. <body>
  49. <div id="header">head</div>
  50. <div id="body">
  51.     <div id="sidebar">left<br />left<br /></div>
  52.     <div id="center">center</div>
  53.     <div id="right">right</div>
  54. </div>
  55. <div id="footer">footer</div>
  56. </body>
  57. </html>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值