这是我的尝试
.string{
background: #b38f72; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2IzOGY3MiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjIwJSIgc3RvcC1jb2xvcj0iI2QwYjI3ZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjQwJSIgc3RvcC1jb2xvcj0iI2QzYjg4OCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjYwJSIgc3RvcC1jb2xvcj0iIzhlNjU0NyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjgwJSIgc3RvcC1jb2xvcj0iIzQwMjExNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMzZjI4MjQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-repeating-linear-gradient(-45deg, #b38f72 0%, #d0b27e 0.5%, #d3b888 1%, #8e6547 1.5%, #402116 2%, #3f2824 2.5%); /* FF3.6+ */
background: -webkit-repeating-gradient(linear, left top, right top, color-stop(0%,#b38f72), color-stop(20%,#d0b27e), color-stop(40%,#d3b888), color-stop(60%,#8e6547), color-stop(80%,#402116), color-stop(100%,#3f2824)); /* Chrome,Safari4+ */
background: -webkit-repeating-linear-gradient(left, #b38f72 0%,#d0b27e 20%,#d3b888 40%,#8e6547 60%,#402116 80%,#3f2824 100%); /* Chrome10+,Safari5.1+ */
background: -o-repeating-linear-gradient(left, #b38f72 0%,#d0b27e 20%,#d3b888 40%,#8e6547 60%,#402116 80%,#3f2824 100%); /* Opera 11.10+ */
background: -ms-repeating-linear-gradient(left, #b38f72 0%,#d0b27e 20%,#d3b888 40%,#8e6547 60%,#402116 80%,#3f2824 100%); /* IE10+ */
background: repeating-linear-gradient(to right, #b38f72 0%,#d0b27e 20%,#d3b888 40%,#8e6547 60%,#402116 80%,#3f2824 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b38f72', endColorstr='#3f2824',GradientType=1 ); /* IE6-8 */
height:6px;
width:100%;
margin-top:20px
}
这是我所追求的那种效果。
https://forrst-live.s3.amazonaws.com/posts/snaps/94811/mega.jpg?1310500628
任何帮助将不胜感激......
答案 0 :(得分:1)
你只需要2个渐变,一个在水平重复,另一个在垂直方向有半透明部分
.test {
position: absolute;
height: 40px;
width: 100%;
background-image:
linear-gradient(0deg, black 0%, rgba(100, 100, 100, 0.2) 10% , white 50% , rgba(100, 100, 100, 0.2) 90% , gray 100% ),
repeating-linear-gradient(to right, black 0px, white 15px)
;
}
答案 1 :(得分:0)
为什么不使用5x5图像而只重复模式?
答案 2 :(得分:0)
使用
background-image: url('data:image/gif;base64,R0lGODdhAgAIAOMQAB0aFSUfDyooKTUxJkA6Gk9EJFlPLFRRSGtnZnNpUHRvXIF3bY+Ifp6Xh7Gunby4rywAAAAAAgAIAAAEDHAERV5xpiW20BFABAA7');
height: 8px;