LONGEPASS
Q99.

何種CSS 語法可使網頁捲動時,背景圖案會跟著移動?

網頁設計 · 乙級 · 應用軟體安裝及使用 · Q99

難易度分析

2 / 5

本題屬於基礎屬性定義之考查,需區分不同 CSS 背景屬性的功能及其合法屬性值。由於選項中包含明顯錯誤的語法與功能不符的屬性,只要掌握基本定義即可快速判定。

正確答案:②{background-attachment: scroll;}

② {background-attachment: scroll;}:background-attachment: scroll 是正確的語法,此設定使背景圖片隨頁面內容一起滾動,為該屬性的預設行為。

錯誤選項解析

  • ① {background-attachment: move;}:background-attachment 屬性的有效值僅有 scroll、fixed 與 local,move 並非合法的 CSS 屬性值,瀏覽器會忽略此宣告。
  • ③ {background-image: scroll;}:background-image 屬性用於指定背景圖片的 URL 路徑,而非控制滾動行為;控制背景是否隨頁面滾動應使用 background-attachment 屬性。
  • ④ {background-repeat: repeat;}:background-repeat: repeat 用於設定背景圖片是否重複平鋪,與背景圖片是否隨頁面滾動無關;其常用值包含 repeat、no-repeat、repeat-x、repeat-y。
Learning Tip

"此題常考 background-attachment 的三個有效值差異:scroll(隨內容滾動)、fixed(相對於視口固定)、local(隨元素內容滾動)。容易混淆的是將 background-image 或 background-repeat 等其他背景相關屬性與滾動行為搞混,需清楚各屬性的職責分工。"

學員答題分佈

①{background-attachment: move;}0%
②{background-attachment: scroll;}0%
③{background-image: scroll;}0%
④{background-repeat: repeat;}0%

此答題分佈是根據學員在 LongePass 模擬考等實際作答紀錄計算而成。與考友分享這道歷屆試題與詳細解析!

相似類型題目