欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

border-colors语法:

-moz-border-left-colors:颜色值;对于border-colors属性,我们要注意三点:

1.如果border-width为w像素,就表示边框可以几种颜色,但是前提每种颜色都是颜色限制唯一的宽度。

2.因为border-colors并不能所有的浏览器都是使用,因此我们在代码前面加一个-moz-。

3.我们不能同时设置四条边颜色,但是我们可以分为四段颜色为四条边的设置。

实例:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

<!DOCTYPE html>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>CSS3 border-colors属性</title>

    <style type="text/css">

    #div1

    {

        width:200px;

        height:100px;

        border-width:5px;

        border-style:solid;

        -moz-border-top-colors:red orange yellow green cyan blue purple;

        -moz-border-right-colors: red orange yellow green cyan blue purple;

        -moz-border-bottom-colors: red orange yellow green cyan blue purple;

        -moz-border-left-colors: red orange yellow green cyan blue purple;

    }

    </style>

</head>

<body>

    <div id="div1">

    </div>

</body>

</html>

具体代码效果:

微信截图_20181023134127.png

7-3-3.png

分析:在以上可以看到border-width:5px;说明使用了5中颜色,那么边框的设置我们就可以使用五种颜色。

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c57365.shtml