Curriculum
Course: CSS
Login

Curriculum

CSS

CSS INTRODUCTION

0/1

CSS Selectors

0/1

CSS Comments

0/1

CSS Padding

0/1

CSS Box Model

0/1

CSS Combinators

0/1

CSS Pseudo-classes

0/1

CSS Pseudo-elements

0/1

CSS Dropdowns

0/1

CSS Image Gallery

0/1

CSS Image Sprites

0/1

CSS Counters

0/1

CSS Website Layout

0/1

CSS Specificity

0/1

CSS Math Functions

0/1
Text lesson

Background Attachment

The background-attachment property determines if the background image should scroll along with the content or remain fixed in place (not scrolling with the rest of the page).

 

Example

Indicate that the background image should remain fixed.

body {
  background-image: url(“img_tree.png”);
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: fixed;
}

 

Example

Indicate that the background image should move along with the page’s scrolling.

body {
  background-image: url(“img_tree.png”);
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: scroll;
}

The CSS Background Attachment Property

Property

Description

background attachment

Specifies if a background image remains fixed or moves with page scrolling.