溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

CSS3如何實(shí)現(xiàn)白色質(zhì)感3D按鈕特效

發(fā)布時(shí)間:2022-03-08 10:56:41 來源:億速云 閱讀:109 作者:小新 欄目:web開發(fā)

這篇文章給大家分享的是有關(guān)CSS3如何實(shí)現(xiàn)白色質(zhì)感3D按鈕特效的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。

  使用方法

  HTML結(jié)構(gòu)

  <div class="grid">

  <button><span>Normal</span></button>

  <button></button>

  <button class="icon">

  <svg width="626" height="512" viewBox="0 0 626 512" xmlns=

  <path fill="currentColor" d="M64 166Q115 115 180 89 244 63 313 63 382 63 447 89 511 115 562 166L528 200Q484 156 429 134 373 111 313 111 253 111 197 134 141 156 98 200L64 166ZM132 234Q169 197 216 178 263 159 313 159 363 159 410 178 457 197 494 234L460 268Q430 238 392 223 354 207 313 207 272 207 234 223 195 238 166 268L132 234ZM200 302Q223 279 252 267 281 255 313 255 345 255 374 267 403 279 426 302L392 335Q376 319 355 311 334 303 313 303 291 303 271 311 250 319 234 335L200 302ZM267 369Q287 351 313 351 339 351 358 369L313 415 267 369Z"></path>

  </svg>

  </button>

  <div class="button" role="button"><span>Not focusable</span></div>

  <div class="button" role="button"></div>

  <div class="button icon" role="button">

  <svg width="626" height="512" viewBox="0 0 626 512" xmlns=

  <path fill="currentColor" d="M64 166Q115 115 180 89 244 63 313 63 382 63 447 89 511 115 562 166L528 200Q484 156 429 134 373 111 313 111 253 111 197 134 141 156 98 200L64 166ZM132 234Q169 197 216 178 263 159 313 159 363 159 410 178 457 197 494 234L460 268Q430 238 392 223 354 207 313 207 272 207 234 223 195 238 166 268L132 234ZM200 302Q223 279 252 267 281 255 313 255 345 255 374 267 403 279 426 302L392 335Q376 319 355 311 334 303 313 303 291 303 271 311 250 319 234 335L200 302ZM267 369Q287 351 313 351 339 351 358 369L313 415 267 369Z"></path>

  </svg>

  </div>

  <button disabled="disabled"><span>Disabled</span></button>

  <button disabled="disabled"></button>

  <button class="icon" disabled="disabled">

  <svg width="626" height="512" viewBox="0 0 626 512" xmlns=

  <path fill="currentColor" d="M64 166Q115 115 180 89 244 63 313 63 382 63 447 89 511 115 562 166L528 200Q484 156 429 134 373 111 313 111 253 111 197 134 141 156 98 200L64 166ZM132 234Q169 197 216 178 263 159 313 159 363 159 410 178 457 197 494 234L460 268Q430 238 392 223 354 207 313 207 272 207 234 223 195 238 166 268L132 234ZM200 302Q223 279 252 267 281 255 313 255 345 255 374 267 403 279 426 302L392 335Q376 319 355 311 334 303 313 303 291 303 271 311 250 319 234 335L200 302ZM267 369Q287 351 313 351 339 351 358 369L313 415 267 369Z"></path>

  </svg>

  </button>

  </div>

  CSS樣式

  {

  from {

  box-shadow: 0 4px 3px 1px #FCFCFC, 0 6px 8px #D6D7D9, 0 -4px 4px #CECFD1, 0 -6px 4px #FEFEFE, inset 0 0 10px 0px rgba(0, 0, 250, 0.6);

  }

  to {

  box-shadow: 0 4px 3px 1px #FCFCFC, 0 6px 8px #D6D7D9, 0 -4px 4px #CECFD1, 0 -6px 4px #FEFEFE, inset 0 0 3px 3px #CECFD1;

  }

  }

  @keyframes active {

  from {

  box-shadow: 0 4px 3px 1px #FCFCFC, 0 6px 8px #D6D7D9, 0 -4px 4px #CECFD1, 0 -6px 4px #FEFEFE, inset 0 0 10px 0px rgba(0, 0, 250, 0.6);

  }

  to {

  box-shadow: 0 4px 3px 1px #FCFCFC, 0 6px 8px #D6D7D9, 0 -4px 4px #CECFD1, 0 -6px 4px #FEFEFE, inset 0 0 3px 3px #CECFD1;

  }

  }

  *,

  *:before,

  *:after {

  box-sizing: border-box;

  }

  body {

  margin: 0;

  padding: 30px;

  background: #f8f8f8;

  min-height: 100vh;

  display: flex;

  align-items: center;

  justify-content: center;

  }

  .grid {

  max-width: 400px;

  margin: 50px auto;

  display: grid;

  grid-template-columns: 150px 150px 50px;

  align-items: center;

  justify-content: center;

  grid-gap: 40px 25px;

  }

  button,

  [role="button"] {

  -webkit-appearance: none;

  -webkit-user-select: none;

  -moz-user-select: none;

  -ms-user-select: none;

  user-select: none;

  display: flex;

  align-items: center;

  justify-content: center;

  outline: none;

  cursor: pointer;

  width: 150px;

  height: 50px;

  background-image: linear-gradient(to top, #D8D9DB 0%, #fff 80%, #FDFDFD 100%);

  border-radius: 30px;

  border: 1px solid #8F9092;

  box-shadow: 0 4px 3px 1px #FCFCFC, 0 6px 8px #D6D7D9, 0 -4px 4px #CECFD1, 0 -6px 4px #FEFEFE, inset 0 0 3px 0 #CECFD1;

  transition: all 0.2s ease;

  font-family: "Source Sans Pro", sans-serif;

  font-size: 14px;

  font-weight: 600;

  color: #606060;

  text-shadow: 0 1px #fff;

  }

  button::-moz-focus-inner,

  [role="button"]::-moz-focus-inner {

  border: 0;

  }

  button > *,

  [role="button"] > * {

  transition: -webkit-transform 0.2s ease;

  transition: transform 0.2s ease;

  transition: transform 0.2s ease, -webkit-transform 0.2s ease;

  }

  button:hover:not([disabled]),

  [role="button"]:hover:not([disabled]) {

  box-shadow: 0 4px 3px 1px #FCFCFC, 0 6px 8px #D6D7D9, 0 -4px 4px #CECFD1, 0 -6px 4px #FEFEFE, inset 0 0 3px 3px #CECFD1;

  }

  button:hover:not([disabled]) > *,

  [role="button"]:hover:not([disabled]) > * {

  -webkit-transform: scale(0.975);

  transform: scale(0.975);

  }

  button:focus:not(:active),

  [role="button"]:focus:not(:active) {

  -webkit-animation: active 0.9s alternate infinite;

  animation: active 0.9s alternate infinite;

  outline: none;

  }

  button:active:not([disabled]),

  [role="button"]:active:not([disabled]) {

  box-shadow: 0 4px 3px 1px #FCFCFC, 0 6px 8px #D6D7D9, 0 -4px 4px #CECFD1, 0 -6px 4px #FEFEFE, inset 0 0 5px 3px #999, inset 0 0 30px #aaa;

  }

  button:active:not([disabled]) > *,

  [role="button"]:active:not([disabled]) > * {

  -webkit-transform: scale(0.95);

  transform: scale(0.95);

  }

  button:disabled,

  [role="button"]:disabled {

  opacity: 0.6;

  cursor: not-allowed;

  }

  button.icon,

  [role="button"].icon {

  width: 50px;

  }

  button.icon svg,

  [role="button"].icon svg {

  margin-top: 3px;

  width: 30px;

  height: 30px;

  }

感謝各位的閱讀!關(guān)于“CSS3如何實(shí)現(xiàn)白色質(zhì)感3D按鈕特效”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI