File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4444
4545``` css
4646.my-element {
47- background : var (--base-color , hotpink );
47+ background : var (--base-color , yellow );
4848}
4949```
50- 你还可以给` var() ` 函数传递第二个参数,表示如果没有找到` --base-color ` 的定义,函数会以` hotpink ` 作为返回值(输出)。
50+ 你还可以给` var() ` 函数传递第二个参数,表示如果没有找到` --base-color ` 的定义,函数会以` yellow ` 作为返回值(输出)。
5151<iframe height =" 300 " style =" width : 100% ;" scrolling =" no " title =" 019 Functions_01 " src =" https://codepen.io/AhCola/embed/YzQPVjx?default-tab=html%2Cresult " frameborder =" no " loading =" lazy " allowtransparency =" true " allowfullscreen =" true " >
5252 See the Pen <a href="https://codepen.io/AhCola/pen/YzQPVjx">
5353 019 Functions_01</a> by Pengfei Wang (<a href="https://codepen.io/AhCola">@AhCola</a>)
5656
5757## 四.有返回值的函数
5858
59- 并不是所有函数都有返回值得 。` var() ` 函数恰好是一个有返回值的函数。` attr() ` 和` url() ` 函数与` var() ` 类似,你可以向它们传递一个或者多个参数,然后将它们作为css声明的属性值。
59+ 并不是所有函数都有返回值的 。` var() ` 函数恰好是一个有返回值的函数。` attr() ` 和` url() ` 函数与` var() ` 类似,你可以向它们传递一个或者多个参数,然后将它们作为css声明的属性值。
6060``` css
6161a ::after {
6262 content : attr (href );
You can’t perform that action at this time.
0 commit comments