• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 11. Layout with Styles > Affixing an Element to the Browser Window

Affixing an Element to the Browser Window

When a visitor scrolls in the browser window, the contents of the window usually move up or down while the Back and Forward buttons, for example, stay stationary or fixed. CSS allows you to affix elements to the browser window so that they don’t move when the visitor scrolls up or down.

To affix an element to the browser window

1.
Type position: fixed; (don’t forget the semicolon).

2.
Type top, right, bottom, or left.

3.
Type :v, where v is the desired distance that you want to offset the element from the edges of the browser window, either expressed as an absolute or relative value (10px, or 2em, for example), or as a percentage of the browser window.

4.
If desired, repeat steps 2 and 3 for additional directions, separating each property/value pair with a semicolon as usual.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint