Relative positioning changes the position of an HTML element relative to its normal display position. So "left:20" adds 20 pixels to the element's LEFT position.
You can use the two values top and left as well as the attribute for moving an HTML element to any position within the HTML document.
You can try running the following code to achieve relative positioning -
<html> <head> </head> <body> <div style = "position:relative;left:80px;top:2px;background-color:yellow;"> This div has relative positioning. </div> </body> </html>
The above is the detailed content of Relative positioning using CSS. For more information, please follow other related articles on the PHP Chinese website!