Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
position: relative question
Old 01-01-2010, 08:36 PM position: relative question
Skilled Talker

Posts: 65
Name: Tony Connelly
Location: Scotland
Trades: 0
I am just learning this and would like some help please. The position: relative, does this mean that the div layer is positioned 50px down from the bottom of the layer above I have this

</div> (end of last layer)

<div style="position: relative; top: 50px; width: auto; height: auto; z-index: auto">

One after another on a page and would like them to be relative in spacing between each layer if you know what I mean but it does not work when i look at the webpage the spacing between some look ok and others don't.
I have messed about and I think nedd to increase by 50 each time like 50, 100, 150, etc... is this from the first div or can I make it relative to the layer before.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
connelly73 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-02-2010, 09:32 AM Re: position: relative question
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,382
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
"z-index: auto" is superfluous as this is the default for elements.

position:relative means that the element will be moved relative to what it's normal (static) position would be which may or may not be where you think it will be.

By the sound of what you are trying to acheive, using margins rather than positioning would be more appropriate.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-02-2010, 10:08 AM Re: position: relative question
Skilled Talker

Posts: 65
Name: Tony Connelly
Location: Scotland
Trades: 0
Quote:
Originally Posted by chrishirst View Post
"z-index: auto" is superfluous as this is the default for elements.

position:relative means that the element will be moved relative to what it's normal (static) position would be which may or may not be where you think it will be.

By the sound of what you are trying to acheive, using margins rather than positioning would be more appropriate.
Don't get what you mean by what it's normal (static) position would be. Can't see what this means other than wher I put the layer in the first place so why have a relative command?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
connelly73 is offline
Reply With Quote
View Public Profile
 
Old 01-02-2010, 10:26 AM Re: position: relative question
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
When an element has a position of relative, then its top, left, bottom, or right properties are adjusted, it fills the same space as it would have normally, but its actual appearance is offset, the place where it would have appeared being empty.

A more common use of position:relative is allowing absolutely positioned elements to be positioned relative to it. Also, in order to have a z-index, an element must some sort of positioning, either relative, absolute, or fixed. This is sometimes a reason to throw in a position:relative, even if no other properties are needed, since relative positioning doesn't remove an element from the "flow" of the document.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 01-02-2010, 10:29 AM Re: position: relative question
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,382
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
the static position is where the element would be in the normal document flow.

You probably don't need any positioning at all, not many layouts actually do. It is purely inexperience and/or a lack of knowledge (or using a WYSIWYG layout tool) that leads developers into having positioning applied to every element.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-02-2010, 10:48 AM Re: position: relative question
Skilled Talker

Posts: 65
Name: Tony Connelly
Location: Scotland
Trades: 0
Thanks guys sorry to be a pain but you have been really helpfull. Starting to get it now and making progress.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
connelly73 is offline
Reply With Quote
View Public Profile
 
Old 01-02-2010, 12:45 PM Re: position: relative question
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
The positioning depends on whether or not there are other positioned elements as the element will be positioned relative to it's nearest positioned ancestor. If there is no positioned ancestor, then the element with positioning will be relative to the BODY.

You might want to check out this positioning tutorial:
http://www.barelyfitz.com/screencast...s/positioning/
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 01-02-2010, 08:32 PM Re: position: relative question
Skilled Talker

Posts: 65
Name: Tony Connelly
Location: Scotland
Trades: 0
You guys are brill I have taken it all on board and made some good changes to my site. The only prblem is I have neglected my content on my site and I'm now racing to re-publish it with all my changes. The info you have provided has made a big difference and its helped me clean up my html code also as I don't think I needed a lot of the position commands.

Thanks Again and Happy New Year. Will stick a final post up in next couple of days when my sig link points to my new design.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
connelly73 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to position: relative question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41072 seconds with 12 queries