--- id: 587d781c367417b2b2512abf title: 降低元素的透明度 challengeType: 0 videoUrl: 'https://scrimba.com/c/c7aKqu4' forumTopicId: 301055 dashedName: decrease-the-opacity-of-an-element --- # --description-- CSS 裏的 `opacity` 屬性用來設置元素的透明度。
屬性值爲 1 代表完全不透明。
屬性值爲 0.5 代表半透明。
屬性值爲 0 代表完全透明。
透明度會應用到元素內的所有內容,不論是圖片,還是文本,或是背景色。 # --instructions-- 將 class 爲 `links` 的所有超鏈接的 `opacity` 屬性值設置 0.7。 # --hints-- 應使用 `links` class 選擇所有的超鏈接,並設置其 `opacity` 屬性值爲 0.7。 ```js assert( /\.links\s*{([\s\S]*?;)*\s*opacity\s*:\s*0*\.70*\s*(;[\s\S]*?|\s*)}/.test( $('style').text() ) ); ``` # --seed-- ## --seed-contents-- ```html

Alphabet


Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.

``` # --solutions-- ```html

Alphabet


Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.

```