Jump to content

what is the use of position: relative; with no values?


Recommended Posts

Can please someone explain what is the use of using the position: relative; with no top/left/buttom/right values?


I saw on the css tutorial they used when creating a tooltip position: relative; but with no values. when I deleted the position: relative; it didnt change nothing as well.


watch here the .tooltip





Link to comment
Share on other sites

By default the span top, left etc value will be auto and so remain in the parent div element and being a inline element appear at the end of text, however if a block element is used it will appear below text. This default positioning is most likely not going to be the ideal position that is required, and so top and left property would be used. IF these properties are used WITHOUT parent div using position: relative; it will attempt to find the next higher parent element using position: relative; and position itself relative to the outer edges of that element. IF! however, no such parent element exist its position will be relative to the browser window itself.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...