EP01 | 跟著影片做前端切版練習 - CSS Glowing Text Typography Effects
練習影片
練習重點
background-clip : 限縮背景顏色的顯示區域。
filter:替元素加上濾鏡。
linear-gradient:顏色漸變效果。
架構
HTML
1 | <body> |
CSS
1 | @import url('https://fonts.googleapis.com/css2?family=Balsamiq+Sans:wght@700&display=swap'); |
小提醒
在使用
linear-gradient()
時,不是使用background-color
,而是background
。在使用
linear-gradient()
時,如果有指定角度的話,角度之間無須空格,如linear-gradient(55deg,...)
, 55 跟 deg 之間不用加空格。在使用偽元素
::before
跟::after
時,一定要注意順序,可以直接將偽元素當成該元素的子元素來看待,子元素的層級都是會比父元素高,而同一層級下的元素,後面元素的層級又會比前面元素的層級高,以上方為例,如果不變動層級的話(不加z-index
),那麼原本的層級應該會是h1::after
>h1::before
>h1
。
Demo:
See the Pen 前端練習01 - CSS Glowing Text Typography by Celeste6666 (@celeste6666) on CodePen.