CSS3: 常用属性

border-radius 圆角

一个值/四个值/每个值拆分成两个方向值

box-shadow 盒子阴影/(性能杀手)

box-shadow: x y [模糊半径] [阴影拓展半径] [阴影颜色] [投影方式]

text-shadow 文字阴影 /(性能杀手)

text-shadow: x y [模糊半径] [阴影颜色]

rgba(r, g, b, a)

注意与opacity的区别

opacity与rgba中的a区别:

opacity下面的元素会继承opacity属性;

rgba中的a仅自己使用。

        <!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>常用属性</title>
    <style>
 button {
 width: 50px;
 height: 50px;
 text-align: center;
 line-height: 50px;
 color: #fff;
 background: orange;
 border-radius: 20px 15px 40px 30px;
 box-shadow: 10px 5px 3px #ffc773;
        }
 p {
 text-shadow: 10px 5px 3px #0eb83a;
        }
    </style>
</head>
<body>
    <button>btn</button>
    <p>不交学费</p>
</body>
</html>
      

v2-ea1ba8a898b4d3b9cdd2595dffb520bb_b.jpg


线性渐变

background:linear-gradient(direction, color [percent], color [percent]) 属性值参数详解如下:

direction //渐变方向

写方向:to bottom/to bottom right……

写角度:0deg/45deg

color //渐变颜色

percent // 百分比

径向渐变

background:radial-gradient(shape r/(a,b) at position, color [percent], color [percent]) 属性值参数详解如下:

shape //形状

circle/ellipse

r/(a,b) // 半径/(长短轴)

position //中心点位置

像素值/百分比/方向(top left)/也可以是一个值,第二个值默认center

*transparent透明

        <!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>常用属性</title>
    <style>
 .box {
 width: 400px;
 height: 400px;
 border: 1px solid #000;
 background: linear-gradient(45deg, #ff8c31, #ffb3a7);
        }
 .circle {
 width: 200px;
 height: 200px;
 /* border: 1px solid #000; */
 border-radius: 50%;
 background: radial-gradient(circle 100px at 100px 100px, #c93756 35%, #f47983, transparent)
        }
    </style>
</head>
<body>
    <div class="box">
    </div>
    <div class="circle">
    </div>
</body>
</html>
      

v2-9cf8ddc76a6285b41e31e17bddfa34d4_b.jpg


CSS3 新增 border值:

可单独设置每边的border

border: border-width border-style b order-color;

给border添加背景图片

border-image:url number style;属性值详解如下:

url //图片地址

number // 图片裁剪的值

style // 图片添加的方式

例如:花边效果


文字属性:文本溢出

text-overflow: clip|ellipsis|ellipsis-word 属性值详解如下:

clip //不显示省略标记(…),而是简单裁切

ellipsis //当对象文本一出时显示省略标记(…),省略标记插入的位置是最后一个字符


white-space:nowrap 文本不会换行,直到遇到 <br> 标签为止。(css2.1)


单行打点:

text-overflow:ellipsis;

white-space:nowrap; //强制文本在一行内显示

overflow:hidden; //溢出内容为隐藏


多行打点:

-webkit-line-clamp: 2;

text-overflow: ellipsis;

display: -webkit-box;

-webkit-box-orient: vertical;//子元素被垂直排列

overflow:hidden;

多行打点兼容性不好,可用js操作


文字属性:文本换行

word-wrap: normal|break-word; 属性值详解如下:

normal //连续文本换行

break-word //内容将在边界内换行(强制换行)


文字属性:文字字体

@font-face{

font-family: 'ShadowsIntoLight’;

src: url('./ShadowsIntoLight.ttf');/*兼容IE*/

src:

url('./ShadowsIntoLight.eot?#iefix') format('embedded-opentype’),

url('./ShadowsIntoLight.woff') format('woff’),

url('./ShadowsIntoLight.ttf') format('truetype’),

url('./ShadowsIntoLight.svg') format('svg');

}

地址:zhaozi.cn/s/all/ttf/ind(这里的字体库更好看)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值