Fixed Positioning
Fixed positioning functions like positioning. Fixes the element's location in relation to the viewport or browser window. This ensures that when scrolling occurs on the page the fixed element remains stationary, on the screen.
Code Sample:
<!DOCTYPE html> <html> <head> <style> .fixed-box { position: fixed; bottom: 10px; right: 10px; width: 200px; height: 50px; background-color: lightgoldenrodyellow; } </style> </head> <body> <div class="fixed-box">This box is fixedly positioned.</div> <p>Scroll down the page to see that the box stays in place.</p> <p style="height: 2000px;"></p> </body> </html> |
Fixed Positioning
Fixed positioning functions like positioning. Fixes the element's location in relation to the viewport or browser window. This ensures that when scrolling occurs on the page the fixed element remains stationary, on the screen.
Code Sample:
<!DOCTYPE html> <html> <head> <style> .fixed-box { position: fixed; bottom: 10px; right: 10px; width: 200px; height: 50px; background-color: lightgoldenrodyellow; } </style> </head> <body> <div class="fixed-box">This box is fixedly positioned.</div> <p>Scroll down the page to see that the box stays in place.</p> <p style="height: 2000px;"></p> </body> </html> |
Copyrights © 2024 letsupdateskills All rights reserved