Fixed positioning allows you to fix the position of an element to a specific location on the page, regardless of scrolling. The specified coordinates will be relative to the browser window.
You can use the two values top and left and the position attribute to move an HTML element to any position in the HTML document.
You can try running the following code to achieve fixed positioning
<html> <head> </head> <body> <div style = "position:fixed; left:80px; top:20px; background-color:blue;color:white;"> This div has fixed positioning. </div> </body> </html>
The above is the detailed content of Fixed position using CSS. For more information, please follow other related articles on the PHP Chinese website!