CSS Top Property

In this chapter you will learn:
About top property
Values of this property
Example of this property

CSS top property is used to set the top edge of element which is absolutely positioned. If the element is static positioned then there will no affect of this property.

Values of this property
Values Description
auto browser calculate the position. It is the default value of top property.
% Used to set the top edge in % (percent)
length Used to set the top edge in px, cm etc.
initial Used to set the deafult value of the property
inherit Inherits from parent element

Example of this property

<html>
<head>
   <title>Example of top property</title>
    <style type="text/css">
        #a
        {
            position:absolute;
            top:80px;
        }           
           
    </style>
    </head>
<body>
<p> Simple paragraph without css property</p>
<p id="a">Paragraph with top property</p>
</body>
</html>

Output:-
example of top property
SUMMARY
In this chapter, you have learned about CSS top property with an example so now you can get help from this chapter to use this property. Click on Next button to continue learning-

More Articles

 

Share your thought



PLEASE DISABLE ADBLOCKER AND SUPPORT US!

Please support us by enabling ads on this page. Refresh

YOU DON'T LIKE ADS, WE ALSO DON'T LIKE ADS!
 
But we have to show ads on our site to keep it free and updated. We have to pay huge server costs, domain costs, CDN Costs, Developer Costs, Electricity and Internet Bill. Your little contribution will encourage us to regularly update this site.