Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

80 users online



CSS Absolute Positioning

CSS Absolute Positioning

Currently viewing this thread: 1 (0 members and 1 guests)


Profiler

Profiler

RUIN.
Status: Offline!

CSS Absolute Positioning

What's the point of using relative positioning in a layout when you have absolute positioning?

Absolute positioning is MUCH easier to use and understand.

___________________

Moeface.

BigToach

BigToach

Neversidian
Status: Offline!

because moving things relative is moving them relative to where they were supposed to be. So if you have something absolutely positioned, you can move a child of that tag relative to its parent.

so if I had something like

Code:

<div>This is a sentence <span style="position: relative; top: 10px; left: 5px;">that ends with a bang</span></div>


the results would be something like

PHP:

<?php
This is a sentence 
                           that ends with a bang
?>


Just as a note, the sentence would look like

Code:

This is a sentence that ends with a bang

without the relative style

now if you moved that whole div absolute, you can move just the second half of the sentence relative to the whole div.

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

Last edited by BigToach, November 20th, 2005 02:52 PM (Edited 2 times)

Mr_B

Mr_B

Neverside Newbie
Status: Offline!

Not all websites have fixed widths.

___________________

http://mrbsdomain.com/images/sig_mrb.gif
Mr. B's Domain | e-mail/MSN nx_2000.at.hotmail.com | AIM/Yahoo tagmisterb

admiralskeet

admiralskeet

cssNinja
Status: Offline!
Originally posted by Mr_B:

Not all websites have fixed widths.


Doesn't matter, absolutely positined elements can have a variable widths (%'s, ems, etc...)

Relative vs Absolute positioning has alot to do with the document flow.

take this for example:

<div id="1"></div>
<div id="2"></div>
<div id="3"></div>

using absolute positioing you can place div 3 above 1 and 2 if you wanted to, however with relative positioning 3 is always going to be dependendt on it's original place in teh document, in this case, last.

___________________

http://www.userbars.com/galerie/images/files/3/4/phpuser.jpg
:07 Seconds a Web Development/Web Design Blog

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0082 seconds.