CSS Position fixed

Please Share On:

Definition:

CSS position: fixed keeps the element always in the same position even the page is scrolled up and down.

The top, right, bottom, left property is used to position an element.

See an example below of using CSS position: fixed with top and right property.

Syntax:

position: fixed;

Source Code:

<!DOCTYPE html>
<html>
<head>
<style> 
.fixed {
  position: fixed;
  bottom: 0;
  left:0;
  padding: 5px;
  color: white;
  background-color: black;
  border: 3px solid red;
}
</style>
</head>
<body>

<h3>CSS position:fixed defined in bottom left corner using bottom and left properties</h3>

 <div class="fixed">This is a fixed paragraph in bottom left corner</div>

</body>
</html>

Output:




You may be interested in the following topics:

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright @2023. All Right Reserved.


Social media & sharing icons powered by UltimatelySocial