CSS小技巧总结

来源:互联网 发布:淘宝客服需要做些什么 编辑:程序博客网 时间:2024/05/06 00:49

block块中文字的上下居中:设置完height后文字本身的line-height属性设为同一数值;

block块中文字的左右居中:不设置width属性,而padding的左右设置为0,上下设置数值,如设置为0 10px(10可以换成其他数);

在设置position:absolute之前,其父级元素设置为position:relative;之后,设定top和left的值以精确定位

小三角块的代码实现:

div{        position: absolute;width: 0;height: 0;overflow: hidden;border: 7px solid transparent;border-top-color: #2DCB70;}
border最后一个属性设置为transparent,三角向下设置border-top-color,向上设置bottom,向左设置right,向右设置left

0 0
原创粉丝点击