html 1-3-1布局,3.web前端—HTML+CSS布局(1)

酷狗网页布局

56fa6704a713

image.png

一、网页基本布局(永远是第一步)

代码

酷狗网页布局

/*css样式*/

body div{

width: 1520px;

}

.a{

background-color: red;

height: 100px;

}

.bc{

background-color: yellow;

height: 500px;

}

.d{

background-color: green;

height: 100px;

}

.b{

width: calc(21%);

height: 500px;

background-color: aqua;

}

.c{

width: calc(79%);

width: 1200px;

background-color: blueviolet;

}

展示效果

56fa6704a713

image.png

二、设置头像和昵称

叫帅哥

/*css样式*/

.head{

width: 50px;

height: 50px;

border-radius: 50%; /*设置圆角图片*/

}

#name{

position: absolute;

margin-top: 5px;

margin-left: 8px;

color: white;

font-size: 13px;

}

二、设置头像、昵称、图标、输入框

代码

酷狗网页布局

cfe047d83edd1856

小可爱叫帅哥哦

svip.png

%E4%BA%91.png

%E7%AE%AD%E5%A4%B4.png

%E5%88%B7%E6%96%B0.png

%E6%90%9C%E7%B4%A2%20.png

%E8%AF%AD%E9%9F%B3.png

%E5%8F%89.png

%E6%9C%80%E5%B0%8F%E5%8C%96.png

%E8%BF%94%E5%9B%9E%E9%A1%B6%E9%83%A8.png

%E6%89%8B%E6%9C%BA.png

%E7%AB%96%E7%BA%BF.png

%E8%AE%BE%E7%BD%AE.png

%E7%9A%AE%E8%82%A4.png

%E4%BF%A1.png

%E8%8F%9C%E5%8D%95.png

%E5%8E%86%E5%8F%B2.png

/*css样式*/

body > div{

width: calc(100%);

}

.a{

background-color: orchid;

height: 50px;

}

.bc{

background-color: yellow;

height: 500px;

}

.d{

background-color: skyblue;

height: 60px;

}

.b{

width: calc(21%);

height: 500px;

background-color: aqua;

float: left;

}

.c{

width: calc(79%);

height: 500px;

background-color: pink;

float: right;

}

.a img{

width: 18px;

height: 18px;

}

.a .head{

margin-left: 5px;

margin-top: 5px;

float: left;

width: 40px;

height: 40px;

border-radius: 50%;

}

#name{

float: left;

margin-top: 18px;

margin-left: 8px;

color: white;

font-size: 13px;

}

.svip-img{

float: left;

margin-top: 14px;

margin-left: 12px;

}

.cloud-img{

float: left;

margin-top: 14px;

margin-left: 17px;

}

.jiantou-img{

float: left;

margin-top: 16px;

margin-left: 70px;

width: 25px;

height: 25px;

}

.shuaxin-img{

float: left;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

#search{

float: left;

margin-left: 15px;

margin-top: 15px;

}

.search-style{

float: left;

border-radius:30px ;

width: 300px;

}

.search-image{

float: left;

margin-top: 4px;

margin-left: -25px;

}

.yuyin-img{

float: left;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.lishi-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.caidan-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.xin-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.pifu-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.shezhi-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.xian-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.phone-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.back-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.xiao-img{

float: right;

margin-top: 16px;

margin-left: 15px;

width: 25px;

height: 25px;

}

.cha-img{

float: right;

margin-top: 16px;

margin-left: 15px;

margin-right: 2px;

width: 25px;

height: 25px;

}

展示效果

56fa6704a713

image.png

还有许多可以改善的地方

比如说可以设置图标的统一样式,可以节省很多代码

还有涉及到浮动的地方,本例中父元素设置了宽高,所以不用清除,但是很多时候,我们的容器大小是由内容撑开的,比较具有灵活性,这时浮动就需要我们清除了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值