博主信息
博文 9
粉丝 0
评论 0
访问量 4980
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
3月27日作业
好的博客
原创
522人浏览过

双飞翼布局

<!doctype html>

<html>

<head>

<meta charset="UTF-8">

<title>经典的双飞翼布局</title>

<style type="text/css">

.header,.footer{

widows: 100%;

height: 65px;

background-color: lightgray;


}

.footer{

/*底部二边不能有浮动元素*/

clear:both;

}

.content{

/*总宽度1000*/

width: 1000px;

min-height: 100%;

background-color: gray;

/*使水平居中*/

margin: auto;

/*使其内部的文本水平垂直居中*/

text-align: center;

line-height: 60px;

}

/*设置主体的基本样式*/

.container {

/*设置主体的总宽度:非常关键*/

width: 1000px;


/*设置主体内部所有区块水平居中*/

margin:auto;


/*使当前区块能够包住内部的浮动区块*/

overflow: hidden;


/*设置背景参考色*/

background-color: yellow;

text-align: center;


}

/*设置中间的部分基本样式*/

.wrap{

width:100%;

background-color: lightgreen;

float: left;

}

/*main 的父级是wrap ,已经有了的样式,不要重复*/

.main{

/*最小高度*/

min-height: 600px;

/*左右宽200的简写*/

margin: 0 200px;

/*背景色为小麦色*/

background-color: wheat;

/*text-align: center; */

}

.left{

width: 200px;

min-height: 600px;

float: left;

/*//-100% 1000px ;*/

margin-left: -100% ; 

/*text-align: center;*/

background-color: red;


}


.right{

width: 200px;

min-height: 600px;

float: right;

/*//-100% 1000px ;*/

margin-left:  -200px ; 

background-color: red;

/*text-align: center;*/


}



</style>

</head>

<body>

<!-- DOM 结构内容 -->

<!-- 头部 -->

<div>

<div>网站头部</div>

</div>


<!-- 主体 -->

<div>

<!-- 再加一个区块,为了防止撑大父级盒子 -->

<div>

<div>主体</div>

</div>

<div>左侧</div>

<div>右侧</div>

</div>

<!-- 底部 -->

<div>

<div>网站底部</div>

</div>

</body>

</html>

圣杯布局

<!doctype html>

<html>

<head>

<meta charset="UTF-8">

<title>圣杯布局</title>

<style type="text/css">

.header,.footer{

width: 100%;

height: 60px;

background-color: lightgreen;

}


.footer{

clear: both;

}


.content{

width: 1000px;

height: 100%;

background-color: 100%;

margin: auto;

text-align: center;

line-height: 60px;


}

.container{

width: 600px;

background-color: yellow;

margin: auto;

overflow: hidden;

padding: 0 200px;

}

.main{

/*设置一个最小行高*/

min-height: 650px;


/*宽必必须为100%,即与父元素container一致,这样才能使left,right挤下来*/

width: 100%;

float:left;


/*设置参考背景色:小麦色*/

background-color: wheat; 

}

.left {

/*除main外,left和right必须设置宽度*/

width: 200px;

/*最小高度*/

min-height: 650px;


/*左浮动后,因为前面main占据100%宽度,所以自动挤到下一行首*/

float:left;


/*设置左外边距margin为-100%,使它回到main区块的起始点处*/

margin-left: -100%;


/*关键步骤:相对定位,向左为负200,相当于向右移动200px;*/

position: relative;

left: -200px;


/*设置参考背景色:天蓝色*/

background-color: lightskyblue; 

}

.right {

width: 200px;

min-height: 650px;

float:left;

margin-left:-200px;

position: relative;

/*right:-200px;*/

left: 200px;

/*设置参考背景色*/

background-color: lightgreen;

}

</style>

</head>

<body>

<!-- DOM结构部分 -->

<!-- 头 -->

<div>

<div>网站头部</div>

</div>

<!-- 主体(内容区) -->

<div>

<div>中间</div>

<div>左边</div>

<div>右边</div>

</div>

<!-- 尾部 -->

<div>

<div>网站尾部</div>

</div>

</body>

</html>

作业照片

777777777777777.jpg

批改状态:合格

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学