AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
CSS Top |
The top property specifies the distance from the top of the element to the default location of the element (when position=relative) or the distance between the top of the element and the top of the container (when position=absolute). This can be specified as a percentage, as a length, or 'auto'. Let's take a look at two examples: Example 1: CSS Code
The HTML code,
renders Sample text. Without using the top property, the text would have appeared right against the top edge of the pink container. In the above example, the text is 10px from the default location. Example 2: CSS Code
The HTML code,
renders Sample text. In the above example, the text is 10px above the default location. So, when a relative position is specified, a positive value for "top" means the element is located below the default location, while a negative value for "top" means the element is located above the default location. |
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.