iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > HTML, XHTML and CSS

Reply
 
LinkBack Thread Tools
Old October 29th, 2007, 08:26 PM   #1
New Member
 

Join Date: Oct 2007
Location: hello
Age: 29
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 google is on a distinguished road
positioning - relative or absolute?

hi all, im relatively new to web design, only got in to css last week and still learning a lot.

i made my first proper functional site, using fully w3 compliant html and css yesterday, but have been told that my method for positioning divs etc i bad.

the way i do it at the moment, the only way i know how, is using absolute positioning. so my stylesheet is sort of as follows:

Code:
div.logo
{
    border-style: solid;
    border-width: 1px;
    border-color: #3D3D3D;
    position: absolute;
    background: url('../images/topbg.jpg');
    background-repeat: repeat-x;
    text-align: left;
    width: 65%;
    top: 5px;
    left: 17.5%;
    right: 17.5%;
    height: auto;
}

div.topbar
{
    border-style: solid;
    border-width: 1px;
    border-color: #3D3D3D;
    background: url('../images/topbarbg.jpg');
    background-repeat: repeat-x;
    position: absolute;
    width: 65%;
    left: 17.5%;
    right: 17.5%;
    top: 103px;
    height: 24px;
    text-align: right;

}

div.content
{
    background-color: #FFFFFF;
    border-style: solid;
    border-width: 1px;
    border-color: #3D3D3D;
    border-top: none;
    position: absolute;
    top: 129px;
    bottom: 31px;
    width: 65%;
    left: 17.5%;
    right: 17.5%;
    text-align: center;
}

div.content_box
{
    position: absolute;
    top: 1%;
    left: 20%;
    right: 1%;
    bottom: 1%;
    text-align: center;
    overflow: auto;
}
so im setting the absolute positions of everything. i have been told this i bad, and that i should use relative positions, but i just dont understand how. help would be appreciated, thx!
google is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 06:36 AM   #2
Reputable Member
 

Join Date: Sep 2007
Location: Tehran - Iran
Age: 30
Posts: 432
Blog Entries: 2
Thanks: 7
Thanked 7 Times in 7 Posts
Rep Altering Power: 0 marSoul is on a distinguished road
Re: positioning - relative or absolute?

You can see this link :
http://www.w3schools.com/css/pr_class_position.asp
it has examples of how they work
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

marSoul is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 07:43 AM   #3
Most Reputable Member
 

Join Date: May 2007
Location: UK
Age: 28
Posts: 1,107
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 MikeHopley is just really nice MikeHopley is just really nice MikeHopley is just really nice MikeHopley is just really nice MikeHopley is just really nice
Re: positioning - relative or absolute?

You should not use positioning at all yet. Learn how to use floats first. Most page layouts can easily be achieved using floats.

Absolute and relative positioning are highly specialised tools. Don't use them indiscriminately, or you'll create a horrible mess!
MikeHopley is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 08:28 AM   #4
New Member
 

Join Date: Oct 2007
Location: hello
Age: 29
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 google is on a distinguished road
Re: positioning - relative or absolute?

Quote:
Originally Posted by marSoul View Post
You can see this link :
http://www.w3schools.com/css/pr_class_position.asp
it has examples of how they work

sorry, but i dont understand any of that lol
google is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 08:34 AM   #5
Reputable Member
 

Join Date: Sep 2007
Location: Tehran - Iran
Age: 30
Posts: 432
Blog Entries: 2
Thanks: 7
Thanked 7 Times in 7 Posts
Rep Altering Power: 0 marSoul is on a distinguished road
Re: positioning - relative or absolute?

which part dont u understand ?
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

marSoul is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 09:58 AM   #6
Elite Veteran
 

Join Date: Sep 2006
Location: Pink House
Posts: 3,941
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Lchad is a name known to all Lchad is a name known to all Lchad is a name known to all Lchad is a name known to all Lchad is a name known to all Lchad is a name known to all
Re: positioning - relative or absolute?

I never understand W3Schools either...
It's like reading an encyclopedia.

Try this tutorial. It will show you how to create a simple 2 column layout without using any positions. Just floats. Once you learn this... you will be so happy!

Positions should not be used for most elements because they will cause headaches. On occasion you will need them but rarely.
Lchad is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 01:41 PM   #7
Elite Veteran
 

Join Date: Jan 2007
Location: You know where
Age: 32
Posts: 4,607
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all
Re: positioning - relative or absolute?

Yeah ... I never use position: absolute or position: relative .... only float: left or float: right

Less headaches
karinne is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 01:48 PM   #8
Most Reputable Member
 

Join Date: May 2007
Location: UK
Age: 28
Posts: 1,107
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 MikeHopley is just really nice MikeHopley is just really nice MikeHopley is just really nice MikeHopley is just really nice MikeHopley is just really nice
Re: positioning - relative or absolute?

Quote:
Originally Posted by karinne View Post
Yeah ... I never use position: absolute or position: relative .... only float: left or float: right

Less headaches
There are, however, some nifty applications of positioning. For example, by applying absolute positioning to an image inside a relatively positioned parent, I can create a decorative image that breaks out of its parent's containing block, yet whose position will remain fixed relative to the parent (not the viewport).

This technique is superb for decorating pages in an elastic layout. If you scale the layout, the image will remain anchored in whatever way you desire.

Last edited by MikeHopley; October 30th, 2007 at 01:50 PM..
MikeHopley is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 01:50 PM   #9
Elite Veteran
 

Join Date: Jan 2007
Location: You know where
Age: 32
Posts: 4,607
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all
Re: positioning - relative or absolute?

I don't deny that they have their uses but for someone who is just learning CSS, it's best, like you said, to stay away from them
karinne is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 02:05 PM   #10
Elite Veteran
 

Join Date: Jul 2007
Location: Webforumz 24/7
Age: 16
Posts: 3,800
Blog Entries: 9
Thanks: 2
Thanked 3 Times in 3 Posts
Rep Altering Power: 0 alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all
Re: positioning - relative or absolute?

I only use absolute for banners in the top left/right.
It's quite useful for that
__________________
Web Design and Development Blog

Alex Perry
Technical Administrator.
alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 30th, 2007, 02:08 PM   #11
WebForumz Admin Badge
 
Marc's Avatar
 

Join Date: Apr 2007
Location: Scotland, UK
Posts: 2,086
Thanks: 2
Thanked 23 Times in 23 Posts
Rep Altering Power: 85 Marc is just really nice Marc is just really nice Marc is just really nice Marc is just really nice
Re: positioning - relative or absolute?

Hi Google,

If you want to get a better understanding (while you are doing/looking at Linda's tutorial) have a look at this site before hand: http://css.maxdesign.com.au/floatutorial/.

I found it very interesting and helpful when i started out.
__________________
Regards
Marc
Administrator - Webforumz.com

Web Design and Development Blog - Marc Fraser
Marc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 31st, 2007, 02:16 AM   #12
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: positioning - relative or absolute?

Position absolute used by spamers to create their pop up irritating advertisement window!
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 8th, 2007, 12:39 PM   #13
New Member
 

Join Date: Nov 2007
Location: Norwich, UK
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 digilover is on a distinguished road
Re: positioning - relative or absolute?

There's many valid uses for positioning especially when your source code is ordered in a different way to the design. I'd recommend reading Andy Clarke's Transcending CSS for examples - an excellent book anyway.

James.
digilover is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 8th, 2007, 01:00 PM   #14
Elite Veteran
 

Join Date: Jan 2007
Location: You know where
Age: 32
Posts: 4,607
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all karinne is a name known to all
Re: positioning - relative or absolute?

I definitely recommend Andy's book ... I read it and I learned quite a few things.

But ... for simple design, floats are the best to use.
karinne is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Absolute Div, wrapped in Relative Div (IE6 - AARRRGGHH) tenderfoot HTML, XHTML and CSS 3 February 7th, 2008 03:43 PM
When is it ok to use Absolute Positioning ?? slimboyfatz32 HTML, XHTML and CSS 31 February 6th, 2008 02:25 PM
absolute positioning micker Flash and ActionScript 1 May 21st, 2007 04:17 PM
CSS Challenge... absolute AND relative positionning Trollivier HTML, XHTML and CSS 5 February 9th, 2007 01:41 PM
loadMovie function (and absolute/relative URL's) DocBoy52 Flash and ActionScript 1 August 26th, 2006 02:16 AM


Search Engine Optimization by vBSEO 3.2.0 RC8