w3schools position fixed code example

Example 1: fixed positioning html

/*
position: fixed;
An element with position: fixed; is positioned relative to the viewport, 
which means it always stays in the same place even if the page is scrolled. 
The top, right, bottom, and left properties are used to position the element.
ex; Navigation BARS
A fixed element does not leave a gap in the page where it would normally have
been located.

Here is the CSS that is used:*/

div.fixed {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 300px;
  border: 3px solid #73AD21;
}

Example 2: css sticky navigatiojn

nav {
	position:sticky;
	top:0;
}

/*Top can be replaced with bottom, left, or right 
	depending on what you want :) */

Tags:

Css Example