The background-attachment property specifies whether the background image should scroll or be fixed (will not scroll with the rest of the page):

Example

Specify that the background image should be fixed:

body {

  background-image: url("img_tree.png");

  background-repeat: no-repeat;

  background-position: right top;

 background-attachment: fixed;

}


Example

Specify that the background image should scroll with the rest of the page:

body {

 background-attachment: scroll;

}


CSS initial Keyword


Example

Set the text color of the <div> element to red, but keep the initial color for <h1> elements:

div {

  color: red;

}


h1 {

  color: initial;

}

Definition and Usage

The initial keyword is used to set a CSS property to its default value.

The initial keyword can be used for any CSS property, and on any HTML element.




CSS inherit Keyword


Example

Set the text-color for <span> elements to blue, except those inside elements with class="extra":

span {

 color: blue;

}


.extra span {

  color: inherit;

}

Definition and Usage

The inherit keyword specifies that a property should inherit its value from its parent element.

The inherit keyword can be used for any CSS property, and on any HTML element.