Subscribe to RSS

Using relative positioning in CSS

Relative positioning can come in handy in CSS, you are much more powerful as a designer if you can place things in the exact location you are pressing towards. There are a lot of times when you want to put an object somewhere and you are unsure of how you are going to place it. Whether it be just outside of your box or just above another object. The position of your object in your HTML document is important in design. You can’t always just use the restrictive box for your web sites, web designs more and more are breaking out of the box form and becoming much more elegant designs.

When it comes to positioning things relatively it isn’t a complicated task, you just need to figure out how to differentiate between relative positioning and absolute positioning. When you are using relative positioning you are placing an object somewhere from top or left of the current position (relatively). Let me give an example of this idea.

#headerContainer {position: relative; left: 30px; top: -20px;}

This CSS example will position the headerContainer object 30 pixels from the left and move it 20 pixels from the top. You can use negative or positive space to place the object. This comes in handy any time it is needed. I try to avoid using positioning as sparsely as possible to avoid any cross browser issues that may develop from its use. This article is a complimentary article to using negative margin to position objects. With both of these ideas in hand you become a much more powerful designer and can move towards more complicated designs.

Popularity: 7%

Whats Next?

  • Save to Delicious! Save the page

2 Responses to “Using relative positioning in CSS”

  1. dustin brewer - web design news and style » Blog Archive » Using negative margin in CSS Says:

    […] Related articles Using relative positioning in CSS […]

  2. Fernando Says:

    Great series of articles in a CSS 101 kind of way. There needs to be more of this kind of article for beginning CSS developers.

Leave a Reply


Recent comments

CSS fix for the double margin float bug in IE6

On July 24, 2008, katalyst wrote:

omg finally bigtime thank you! i’ve been looking for a solution and yours works for me.

Understanding color in design

On July 23, 2008, Christy wrote:

i am what is referred to as a “traditional artist”- i am a fine art major & have taken a ton of color theory courses. I get confused when reading articles about color...

The best free web development add-ons for IE 6 and 7

On July 23, 2008, Valentinka wrote:

Сайт, да нет это целый портал - с фишкой. Буду теперь постоянно посещать…. и всем...

CSS fix for the double margin float bug in IE6

On July 23, 2008, agencja modelek wrote:

finally found what I sought! thx for this fix! regards, AM

Test IE5 or IE6 on your PC with IE7 installed

On July 21, 2008, Ken Hamric wrote:

CrossBrowserTesting.com allows you to check your site ‘live’ via connection via VNC to several configurations of OS and browsers. The browsers available...