html怎么做qq空间主页,QQ空间首页布局

html>

QQ空间首页布局

body,ul,li{

margin: 0;

padding: 0;

}

body{

margin: 0px;

padding: 0px;

background-color: lightskyblue;

background-image: url("img7.jpg");

background-repeat: no-repeat;

background-size: cover;

}

.nav{

width: 100%;

height: 50px;

background-color: black;

position: fixed;

}

.content{

position: absolute;/*绝对定位*/

left: 0;

right: 0;

top: 50px;

margin: auto;

width: 1000px;

height: 800px;

background-color: olive;

}

.content .head{

width: 1000px;

height: 150px;

background-color: red;

}

.content .main{

width: 1000px;

height:600px;

background-color: lavender;

position: relative;/*相对定位*/

}

.content .main .left{

width: 170px;

height: 600px;

background-color: rebeccapurple;

position: absolute;/*绝对定位*/

top: 0;

left: 0;

}

.content .main .middle{

width: 510px;

height: 600px;

background-color: lightcoral;

margin-left: 180px;

margin-right: 310px;

}

.content .main .right{

width: 300px;

height: 600px;

background-color: lawngreen;

position: absolute;/*绝对定位*/

top: 0px;

right: 0px;

}

.content .main .foot{

width: 1000px;

height: 50px;

background-color: lightslategray;

}

头部
左边
中间
右边
底部

总结:相对定位:自己本身位置没变,以自身为起始点移动

绝对定位:已经脱离文档流了,有多个div都脱离文档流,它们会一个一个覆盖,与浮动不同,浮动是一个个水平排列,不会覆盖

QQ空间布局注意:3.1要设置主体main为relative(相对定位)以它为参照  3.2左边.右边绝对定位,中间大于左边距离,大于右边距离即可

QQ空间布局注意:整个内容区块content 设置绝对定位 顶部大于头部 左边右边都为0 margin: auto;居中

运行效果图:

bea3eff3b7b2d9f6f4d963e121165388.png

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值