前端开发小技巧

布局

1.一般分为header、content、footer等内容(页头、正文、页脚)
2.使用reset.css初识化整个布局,让整个布局标准化,地址:https://github.com/necolas/normalize.css

标签及属性

display:inline-block 使li标签里的元素变成横向排列
text-decoration:none list-style:node  去除默认的样式

navbar

设置链接的热区:
display: inline-block;
height: inherit;
高度继承父元素,并且变为行内元素,这样点击不必要对准字母了

div居中

text-align: center;
margin: 0 auto;
position: relative;
top: 160px;
前两个使文字居中、div块居中,把位置设置成relative才能设置top属性

使一个模块中的两个div左右分配

.article-preview > div{
float: left;
}

.article-preview:after{
content: "";
display: block;
clear: both;
}
第一个>的作用是设置子标签(不包括子标签的标签)的样式
第二个是清除浮动的作用

模块背景颜色差异化

.article-preview:nth-child(odd){
background-color: rgba( 255 , 255, 255, 0.05);
}
奇数的背景会加上一层蒙版

背景图片固定效果

.main-wrapper{
background: #444 url( ../img/banner.jpg);
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}

背景和字体冲突显得模糊时

header{
background: rgba( 0, 0, 0, 0.4);
}

vscode使用技巧

1.在空白处输入 lorem可以同乱码填充

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值