酷炫字型背景圖的實現——神奇的background-clip: text
阿新 • • 發佈:2018-12-13
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>background-clip</title> <style> div { margin: auto; width: 1000px; height: 300px; line-height: 300px; text-align: center; font-size: 120px; font-weight: bold; color: transparent; /* 重點1 */ background: url("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493353832&di=c063b6b9c89082e96ffee0766112ffec&imgtype=jpg&er=1&src=http%3A%2F%2Fpic2016.5442.com%3A82%2F2016%2F0111%2F07%2F3.jpg%21960.jpg") no-repeat center center; background-size: cover; -webkit-background-clip: text; /* 重點2 */ } </style> </head> <body> <div>background-clip</div> </body> </html>