CSS3圆角背景

发布网友 发布时间:2022-04-23 13:01

我来回答

4个回答

热心网友 时间:2022-05-12 19:19

圆角主要是通过border-radius 来实现:

border-radius 属性是一个简写属性,用于设置四个 border-*-radius 属性。

提示:该属性允许为元素添加圆角边框。

简单的例子,仅供参考:

<style>
    .box {margin:100 auto; width:200px; height:200px; position:relative;}
    .shadow {width: 200px; height:200px; background:#ccc; border-radius:10px;}
    .xxx {width:150px; height:150px; background:red; position:absolute;}
</style>
<body>
    <div class="box">
        <div class="shadow"></div>
        <div class="xxx"></div>
    </div>
</body>

热心网友 时间:2022-05-12 20:37

这是IE9一直一来的BUG,可以搜索下Ultimate CSS Gradient Generator这个工具来生成代码

/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzJjZTA2MiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM3ZGI5ZTgiIHN0b3Atb3BhY2l0eT0iMCIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top,  rgba(44,224,98,1) 0%, rgba(125,185,232,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(44,224,98,1)), color-stop(100%,rgba(125,185,232,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  rgba(44,224,98,1) 0%,rgba(125,185,232,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  rgba(44,224,98,1) 0%,rgba(125,185,232,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  rgba(44,224,98,1) 0%,rgba(125,185,232,0) 100%); /* IE10+ */
background: linear-gradient(top,  rgba(44,224,98,1) 0%,rgba(125,185,232,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ce062', endColorstr='#007db9e8',GradientType=0 ); /* IE6-8 */
filter: none\9\0;/*ie9*/

热心网友 时间:2022-05-12 22:12

...用两个图层,
父框应用圆角,子框应用渐变!
然后在父框用"overflow:hidden;"
其他IE版本有问题就HACK;

热心网友 时间:2022-05-13 00:03

你好 圆角的话 如下 border-radius:10px;
希望能帮到你 谢谢

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com