tomer Posted April 26, 2016 Share Posted April 26, 2016 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 http://www.w3schools.com/css/tryit.asp?filename=trycss_tooltip Thanks Link to comment Share on other sites More sharing options...
davej Posted April 26, 2016 Share Posted April 26, 2016 It is useful to put absolutely positioned items inside a relative container. https://www.google.com/?gws_rd=ssl#q=css+absolute+positioning+inside+relative Link to comment Share on other sites More sharing options...
dsonesuk Posted April 26, 2016 Share Posted April 26, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now