美文网首页
CSS3知识汇总14

CSS3知识汇总14

作者: 0清婉0 | 来源:发表于2021-02-17 12:58 被阅读0次

【半透明边框】

body{background-color:green}

img{

    border:10px solid hsla(0, 0%, 100%, .5);

    background: white;

    background-clip: padding-box;

}

如果不希望背景侵入边框所在的范围,用padding-box将内边距的外沿把背景裁掉

【实线多重边框】

div{

    width:100px;

    height: 100px;

    margin:80px auto;

    background: yellowgreen;

    box-shadow: 0 0 0 10px #655,

                0 0 0 15px deeppink,

                0 2px 5px 15px rgba(0,0,0,.6);  /*投影*/

}

2.使用outline

div{

    width:100px;

    height: 100px;

    margin:80px auto;

    background: yellowgreen;

    border:10px solid #655;

    outline: 5px solid deeppink; /*适用双重边框*/

}

【虚线双重边框】

div{

    width:100px;

    height: 100px;

    margin:80px auto;

    background: yellowgreen;

    border:10px solid #655;

    outline: 5px dotted deeppink;

}

【背景定位】

div{

    background:url("css3.png") no-repeat bottom right #58a;

    background-position: right 20px bottom 10px;

    width: 600px;

    height: 600px;

}

【边框内圆角】

两个div时:

.con{

    background-color: #655;

    padding: .8em;

}

.con > div{

    background-color: tan;

    border-radius: .8em;

    padding:1em;

}

一个div时:

.con{

    background-color: tan;

    border-radius: .8em;

    padding: 1em;

    box-shadow: 0 0 0 .6em #655;

    outline: .6em solid #655;

    /*box-shadow: 0 0 0 .6em red;

    outline: .6em solid #000;  注释中的改变能看出如何实现的*/

}

【条纹背景】

.con{

    width: 300px;

    height: 200px;

}

1.颜色从#fb3过渡到#58a

background:linear-gradient(#fb3, #58a);

2.色标拉近一点

background:linear-gradient(#fb3 20%, #58a 80%);

3、变为50%,变成两色背景

background:linear-gradient(#fb3 50%, #58a 50%);

4、等宽条纹

background-size: 100% 30px;

background-size后,条纹变成等宽的15px

5、不等宽的条纹

background:linear-gradient(#fb3 20%, #58a 0%);

第二个色值值为0,它的位置就总是被浏览器调整为前一个色值的位置值

6、三色条纹

background:

        linear-gradient(to right,

        blue 33.3%, white 0,

        white 66.6%, red 0);

    background-size: 100% 30px;

7、四色条纹

background:

        linear-gradient(

            #fb3 33.3%, #58a 0,

            #58a 66.6%, yellowgreen 0,

            yellowgreen 88.8%, red 0

        );

8、垂直条纹

background:

        linear-gradient(to right,

            #fb3 50%, #58a 0

        );

to bottom是默认值

9、波纹条纹

background:

        linear-gradient(45deg,

            #fb3 50%, #58a 0

        );

10、斜向条纹

background:

        linear-gradient(45deg,

            #fb3 25%, #58a 0, #58a 50%,

            #fb3 0, #fb3 75%, #58a 0

        );

    background-size: 42px 42px; 

使用 repeating-linear-gradient循环

background:

        repeating-linear-gradient(45deg,

            #fb3, #fb3 15px, #58a 0, #58a 30px

        );

    background-size: 42px 42px;

相关文章

  • CSS3知识汇总14

    【半透明边框】 body{background-color:green}img{ border:10px sol...

  • css3知识汇总:切角

    1.使用渐变 因为渐变可以接受一个角度,比如45deg作为方向,而且色标的位置信息也可以是绝对的长度值,不受容器尺...

  • CSS3知识汇总1

    :nth-child()函数 可以接收一个形如an+b的表达式作为参数,其中a和b是整数,n是从0开始的自然数列 ...

  • CSS3知识汇总5

    【渐变】 线性渐变:从一个位置开始向某个特定的方向渐变,如叶片 径向渐变:从一个位置开始向四周渐变,如灯光散落 l...

  • CSS3知识汇总4

    今晚有个小激动,放下学习后,意外的得到了一笔小回报,虽然钱不多,但很开心。11月学习一小本英文书时发现一个错误,一...

  • CSS3知识汇总2

    这几天学习H5微场景时,发现css知识有些模糊,记得学习CSS时是2007年,到今天已经13年。 之前有很多CSS...

  • CSS3知识汇总3

    19.box-sizing content-box Element Width/Height = border +...

  • CSS3知识汇总15

    渐变组合:透过彼此的透明区域显现 网格图案--桌布 div{ width: 30em; height:30em...

  • CSS3知识汇总9

    这两天晚上都要加班,实在没时间写简书了,就把之前学习的先贴上吧。等春节时,要继续好好学习。多读书,只有自己能力强了...

  • CSS3知识汇总7

    【矩形剪切inset()】 接收4个长度参数,类似相对定位时指定的top、right、bottom、right 即...

网友评论

      本文标题:CSS3知识汇总14

      本文链接:https://www.haomeiwen.com/subject/evjixltx.html