我正在尝试创建一个看起来像这个
的css div元素(只是渐变和边框颜色,而不是形状) 但没有接近它的样子。
也可以使其与所有浏览器兼容
我的尝试是在这个小提琴链接中:https://jsfiddle.net/0bq2nxfn/
HTML:
<body>
<div class="decorator">LEVEL 17</div>
</body>
CSS
.decorator{
background-color:blue;
background: -webkit-linear-gradient(#7df0f8,#56caee, #604d69,#e1acea);
background: -moz-linear-gradient(#7df0f8,#56caee, #604d69,#e1acea);
background: linear-gradient(#7df0f8,#56caee, #604d69,#e1acea);
width: 200px;
height: 40px;
align: center;
text-align:center;
border:2px solid white;
border-radius: 40px;
padding:10px;
color: white;
}
答案 0 :(得分:1)
你可以玩渐变和阴影:pen
Set cObject = myWS.ChartObjects.Add(0, 0, 100, 100)
&#13;
html {
background:linear-gradient(to bottom, rgb(131, 51, 149) 2em,white, rgb(92, 151, 209) 2.1em);
min-height:100vh;;
}
.decorator {
background-color: blue;
background: linear-gradient(
to top,
rgba(179, 99, 198, 1),
rgb(71, 163, 238) 12px,
rgb(71, 163, 238) 50%,
rgb(110, 240, 249) 80%
);
box-shadow: inset 0 -6px 2px -4px rgb(32, 137, 201),
inset 0 0 2px 4px rgb(138, 203, 236),
inset 0 0 3px 5px rgb(50, 219, 246),
0 -1px 3px 2px white;
margin: 1em;
width: 200px;
line-height: 60px;
height:40px;
font-size:30px;
text-align: center;
border-radius: 60px 60px 5px 5px / 40px 40px 10px 10px;
padding: 10px;
color: white;
position: relative;
text-shadow:2px 2px 2px rgb(37, 130, 205), -1px -1px 1px rgb(37, 130, 205);
font-family: 'Give You Glory', cursive;
font-weight:bold;
}
.decorator:before {
content: '';
display: inline-block;
border-radius: 50%;
padding: 4px 6px;
background: rgba(169, 238, 247, 0.7);
position: absolute;
top: 20%;
left: 0.75em;
transform: rotate(-20deg);
box-shadow: -12px 5px 1px -2px rgba(169, 238, 247, 0.7);
}
.decorator:after {
content:' ✵ ★ ✯';
color:rgb(41, 116, 207);
font-weight:bold;
text-shadow:0 0 1px white,0 0 1px white,0 0 1px white,0 0 1px white,0 0 1px white;
filter:drop-shadow( 0 0 1px white);
position:absolute;
bottom:25px;
left:50px;
font-size:1.1em;
transform:rotate(-5deg);
}
&#13;
伪元素可用于光泽效果,最终包括来自png,特殊字符或字体 - 真棒图标的星星。
答案 1 :(得分:0)
你的照片还有很多不仅仅是渐变。 这可能与纯css一样接近。
body{
background-color: #699CDE;
font-family: Arial;
}
.glossy-button, .glossy-button > div{
border-top-left-radius: 50px;
border-top-right-radius: 50px;
border-bottom-left-radius: 14px;
border-bottom-right-radius: 14px;
}
.glossy-button{
padding: 4px;
background-color: white;
display: inline-block;
}
.glossy-button > div{
padding: 25px 64px 16px 64px;
box-shadow: inset 0px 0px 20px 10px #40DFFE, 0px 4px 6px 0px #1a80c3;
background: #74f2fa;
background: -moz-linear-gradient(top, #74f2fa 0%, #3bc0ed 34%, #4b9fed 80%, #984ff7 99%);
background: -webkit-linear-gradient(top, #74f2fa 0%,#3bc0ed 34%,#4b9fed 80%,#984ff7 99%);
background: linear-gradient(to bottom, #74f2fa 0%,#3bc0ed 34%,#4b9fed 80%,#984ff7 99%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#74f2fa', endColorstr='#984ff7',GradientType=0 );
color: white;
font-size: 28pt;
font-weight: bold;
text-align: center;
text-shadow: 0px 2px 4px #1e7fc7;
}
<div class="glossy-button">
<div>Level 17</div>
</div>