css3 - 如何實現字體顏色漸變?
問題描述
問題解答
回答1:先看效果:
直接用photoshop cc畫出來,圖層單擊右鍵可復制SVG或者CSS樣式。
方法二:思路:先設置背景色漸變——規定背景的劃分區域——保險一點再設置(text-fill-color會覆蓋color所定義的字體顏色)
/* 這個文字效果只在webkit內核的瀏覽器上才能正常工作。Firefox 瀏覽器不支持在文字上使用background-clip屬性 */h1.start-gradient { font-weight: bold; font-family: helvetica; text-align:center; background: -webkit-linear-gradient(left, #4f185d , #fe5d4b); /* 背景色漸變 */ -webkit-background-clip: text; /* 規定背景的劃分區域 */ -webkit-text-fill-color: transparent; /* 防止字體顏色覆蓋 */}<h1 class='start-gradient'>快速開始</h1>回答2:
<span class='gradient'>快速開始</span>
.gradient { display: inline-block; font-size: 60px; font-family: ’microsoft yahei’; background-image: -webkit-gradient(linear, left center, right center, from(rgba(176, 31, 184, 1)), to(rgba(255, 89, 76, 1))); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}; 回答3:
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) {
.masked{ background-image: -webkit-linear-gradient(left, #147B96, #E6D205 25%, #147B96 50%, #E6D205 75%, #147B96); -webkit-text-fill-color: transparent; -webkit-background-clip: text; -webkit-background-size: 200% 100%; -webkit-animation: masked-animation 4s infinite linear;}
}@-webkit-keyframes masked-animation {
0% { background-position: 0 0;}100% { background-position: -100% 0;}
}
相關文章:
1. angular.js - angular內容過長展開收起效果2. dockerfile - [docker build image失敗- npm install]3. 在windows下安裝docker Toolbox 啟動Docker Quickstart Terminal 失敗!4. docker-compose中volumes的問題5. golang - 用IDE看docker源碼時的小問題6. Docker for Mac 創建的dnsmasq容器連不上/不工作的問題7. mac里的docker如何命令行開啟呢?8. 我在centos容器里安裝docker,也就是在容器里安裝容器,報錯了?9. docker內創建jenkins訪問另一個容器下的服務器問題10. nignx - docker內nginx 80端口被占用

網公網安備