CSS helps you position HTML elements. You can place any HTML element anywhere you like. You can specify whether an element is positioned relative to its natural position on the page or absolutely positioned based on its parent element.
Let’s look at an example of relative positioning -
<html> <head> </head> <body> <div style = "position:relative;left:70px;top:1px;background-color:blue;color: white;"> This div has relative positioning. </div> </body> </html>
The above is the detailed content of Positioning HTML elements using CSS. For more information, please follow other related articles on the PHP Chinese website!