1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

DIV+CSS原创教材!

本帖由 OUYANG2006-11-26 发布。版面名称:前端开发

  1. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
    由于近期在学习DIV+CSS布局,在学习中的笔记发上来:) :) :) :) ,不好的也别找我算账


    一个垃圾布局做为开头吧

    HTML:
    <!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>
    <link href="sty.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
    <div id="left">
    <div id="y1">163</div>
    <div id="y2">
    <div id="y21"></div>
    <div id="y22"></div>
    <div id="foot"></div>
    </div>
    </div>
    <div id="right"></div>
    
    
    </body>
    </html>
    代码:
    #y1 {
    	background-color: #ff6600;
    	width: 100%;
    	border-top-width: 6px;
    	border-top-style: solid;
    	border-right-style: none;
    	border-bottom-style: none;
    	border-left-style: none;
    	border-top-color: #000088;
    	height: 150px;
    	margin:0px auto;
    }
    #y2 {
    	width: 100%;
    	margin-top: 0px;
    	margin-right: auto;
    	margin-bottom: 0px;
    	margin-left: auto;
    }
    #y21 {
    	width: 180px;
    	background-color: #009966;
    	height: 350px;
    	float: left;
    	
    }
    #y22 {
    	background-color: #9900CC;
    
    	height: 300px
    	float: left;
    	height: 350px;
    }
    
    #right {
    	float: left;
    	background-color: #005500;
    	height: 600px;
    	width: 18%;
    }
    #left {
    	width: 80%;
    	float: left;
    	background-color: #BBBBBB;
    }
    #foot {
    	height: 94px;
    	background-color: #F4F4F4;
    	width: 100%;
    }
    
    body {
        margin: 0px;
    	color: #222222;
    	background-color: #97CF00;
    }
    
    
    
    
    
    演示:httP://toomao.com/ya.html
    (为什么网页没居中,这个以后再讲)

    下一部份讲解上面页面的构成(这两天会在下一篇中出现)
     
  2. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
  3. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
    占位!
     
  4. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
    占位3
     
  5. fyfei

    fyfei New Member

    注册:
    2005-10-07
    帖子:
    9,067
    赞:
    46
    没必要都用左浮动,当两栏布局的时候,其实左右浮动更好.
    #y1已经width: 100%;
    就没必要margin:0px auto;
     
  6. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
    这个意见收藏

    我学到了再改:lol: :lol:
     
  7. 西子宜

    西子宜 Well-Known Member

    注册:
    2005-09-05
    帖子:
    15,739
    赞:
    62
  8. OUYANG

    OUYANG New Member

    注册:
    2005-09-06
    帖子:
    3,025
    赞:
    5
    楼上#7白痴