On 10/08/2009, at 10:35 PM, Naveen Bhaskar wrote:
Hi, Which is the right method to position a logo in the header. with position :relative;top:10px; left:10px; or margin:10px 0 0 10px; pls rell me the pros and cons
With 'position: relative' the element takes up the space in the document where it originally would have been and is then shifted 'relative' to that original position. Margins can be used to push an element around but the space it takes up in the document is where it is visually.
This is particularly noticeable with negative margins. If you set a negative top margin on an element then the element that follows it in the document will also move up the page and the gap between them will be the same as what it would have been originally. If you use relative positioning and set 'top' to a negative value there will be a bigger gap between the positioned element and the following element. This is because the following element will set its position in relation to where the positioned element would have been before positioning.
http://snadden.com/sandbox/relative.html ******************************************************************* List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [email protected] *******************************************************************
