如何创建左右边框不同渐变的按钮

问题描述 投票:0回答:1

如何创建左侧和右侧带有深色区域的圆形渐变按钮:

enter image description here

尝试过的风格

.gradient-hover-effect {
    background: linear-gradient(90deg, #3f51b5, transparent) #2196f3;
    font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size:xx-large;
    padding: 1em;
    color: #fff;
    text-decoration: none;
    transition: background-color 1s;
    place-content: center;
}

但这会产生不太好的按钮:

enter image description here

在现代平板电脑中使用 Google Chrome 浏览器。

html css google-chrome button
1个回答
0
投票

根据看到的这里,这里是:

/* CSS */
.glassbutton {
  background: linear-gradient(#102752, transparent) #2196f3;
  border: 0;
  border-radius: 30px;
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size:xx-large;
    padding: 1em;
  font-weight: 600;
  outline: 0;
  padding: 21px 1em;
  position: relative;
  text-align: center;
  text-decoration: none;
  transition: all .3s;
  text-transform: uppercase;
}

.glassbutton:before {
  background-color: initial;
  background-image: linear-gradient(#fff 0, rgba(255, 255, 255, 0) 100%);
  border-radius: 125px;
  content: "";
  height: 50%;
  left: 4%;
  opacity: .5;
  position: absolute;
  top: 0;
  transition: all .3s;
  width: 92%;
}

.glassbutton:hover {
  box-shadow: rgba(255, 255, 255, .2) 0 3px 15px inset, rgba(0, 0, 0, .1) 0 3px 5px, rgba(0, 0, 0, .1) 0 10px 13px;
  transform: scale(1.05);
}

@media (min-width: 768px) {
  .glassbutton {
    padding: 16px 48px;
  }
}
<button class="glassbutton" role="button">Eraklient</button>

© www.soinside.com 2019 - 2024. All rights reserved.