When is it ok to use Absolute Positioning ??

This is a discussion on "When is it ok to use Absolute Positioning ??" within the Web Page Design section. This forum, and the thread "When is it ok to use Absolute Positioning ?? are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #21 (permalink)  
Old Feb 5th, 2008, 16:30
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

Quote:
Also, I've never ever seen a need to hack for IE. There's always a way to write 1 css that can work on both.
I don't agree with this. IE has many bugs, and you will frequently encounter some of them, including some pretty serious ones.

If you're talking about using CSS tricks to target or exclude browsers, be aware that these are unstable hacks and should be avoided. It's much better to put your IE hacks in a separate CSS file, using conditional comments. This also allows you to validate your main stylesheet.
Reply With Quote
  #22 (permalink)  
Old Feb 5th, 2008, 17:09
JustinStudios's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

I've never had this problem before... and yes my CSS validates. I think most hacks are caused by the fact people get too complicated in their coding and don't understand that they could have done it simpler. I had a friend that had hacked his website for IE and I made him a tiny CSS file that was about 1/2 as long as his original and it worked great for both. I'd link it but it was hosted on his school account and he graduated last semester and no longer has it hosted. I've done basic layouts to extremely complicated E-commerce websites and still haven't found a need to hack it.
Reply With Quote
  #23 (permalink)  
Old Feb 5th, 2008, 17:14
Junior Member
Join Date: Jan 2008
Location: UK
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

hi justinstudios .. here is the link for my test page



many thanks

Last edited by slimboyfatz32; Feb 5th, 2008 at 21:57.
Reply With Quote
  #24 (permalink)  
Old Feb 5th, 2008, 17:22
JustinStudios's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

Yeah.. you have WAY too much code for what you have...

here's how I see the layout...

Header
Navigation - Float: right
/Header
Content
Text - Float: left width: 60% ( can be a pixel value too)
Recent - Float: left width: 40% (can be a pixel value too)
/Content
Footer

That's the way I see the layout needing to be. No positions needed. If you need me to elaborate i'd be happy too.
Reply With Quote
  #25 (permalink)  
Old Feb 5th, 2008, 17:36
Junior Member
Join Date: Jan 2008
Location: UK
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

Quote:
Originally Posted by JustinStudios View Post
Yeah.. you have WAY too much code for what you have...

here's how I see the layout...

Header
Navigation - Float: right
/Header
Content
Text - Float: left width: 60% ( can be a pixel value too)
Recent - Float: left width: 40% (can be a pixel value too)
/Content
Footer

That's the way I see the layout needing to be. No positions needed. If you need me to elaborate i'd be happy too.
Please elaborate (lol) !!!

I want to get the XHTML/CSS coding as tight as possible , and your advice is greatly appreciated !!
Reply With Quote
  #26 (permalink)  
Old Feb 5th, 2008, 18:40
Junior Member
Join Date: Jan 2008
Location: UK
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

could anyone else possibly elaborate ??

many thanks !!
Reply With Quote
  #27 (permalink)  
Old Feb 5th, 2008, 22:33
JustinStudios's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

Well you took your link down so I couldn't snag the images... but I think I remember the layout just fine.

Here's the example: http://blog.justudios.com/test.htm

Here's the layout code:
Code: Select all
<div id="Header">
    <div id="Nav">
        <ul>
            <li  class="nv"><a href="/">Home</a></li>
            <li  class="nv"><a href="#">Link 2</a></li>
            <li  class="nv"><a href="#">Link 3</a></li>
            <li  class="nv"><a href="#">Link 4</a></li>
        </ul>
    </div>
</div>
<div id="wrapper">
    <div id="content">
    </div>
    <div id="otherContent">
    </div>
</div>
<div id="Footer">
</div>
and the CSS...
Code: Select all
body {margin: 0;
      padding: 0;}
#Header {width: 100%;
        height: 145px;
        background: #000000;}
#Nav {height: 75px;
    float: right;
    background-color: #FFFF00;}
#wrapper {width: 100%;
          height: 500px;
          background: #FFFFFF;}
#content {float: left;
          width: 60%;
          height: 500px;
          background: #FFFF00;}
#otherContent {float: left;
            width: 40%;
            height: 500px;
            background: #FFF000;}
#Footer {width: 100%;
        height: 35px;
        background: #FF9900;}
.nv a:Link, .nv a:Visited{
    text-decoration: none;
    padding: 0 25px 0 25px;
    font: bold 12px Verdana, Arial, Helvetica, sans-serif;
    color: #000000;}
.nv a:Hover{
    text-decoration: none;
    padding: 0 25px 0 25px;
    font:  bold 12px Verdana, Arial, Helvetica, sans-serif;
    color: #0000FF;}
ul {list-style: none;}
li {display: inline;}
Now your design looked like a fixed width layout, so you might want to change the percentages into pixels for that...
Reply With Quote
  #28 (permalink)  
Old Feb 6th, 2008, 07:53
Junior Member
Join Date: Jan 2008
Location: UK
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

hi justin , thanks greatly for the time and effort , apologies here is the link again for the images ..... http://www.firstbasedesign.co.uk/index_test.html

its just so i can visualise it that little bit better.

many thanks


also with my page , i was aiming to put the 'wrapper' div around all my other divs , so that everything centred on screen.. ie:

<body>
<div id=wrapper>
<div id=header></div>
<div id=main></div>
</div>
</body>

etc etc.....

Last edited by slimboyfatz32; Feb 6th, 2008 at 07:58.
Reply With Quote
  #29 (permalink)  
Old Feb 6th, 2008, 10:21
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

Quote:
Originally Posted by JustinStudios View Post
I've done basic layouts to extremely complicated E-commerce websites and still haven't found a need to hack it.
Well I most certainly have found a need to hack for IE, and I know the CSS specs inside out.

Of course, I could avoid this hacking by limiting the layout methods that I use. Using flexible/elastic layouts, for example, complicates matters considerably. But I believe it's worthwhile for the user benefit.

Not all complexity is a bad thing.

In any case, I think you'd be remarkably lucky to never encounter an IE bug. They are everywhere.
Reply With Quote
  #30 (permalink)  
Old Feb 6th, 2008, 14:48
JustinStudios's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

You don't need a wrapper around the whole site to make it centered. You can use the margin: o auto on the Header and the wrapper in my code and that'll center it also. Just make sure you zero out the body still. Also sometimes to center in IE you gotta use text-align so make sure if you do use that you default your text back before you use it. Even by doing so you'll still have valid code AND you won't have to waste time writing a switch statement on browsers or produce that nasty bloated code.

I found a reason to hack IE btw... After many many many hours of looking at sites I finally found 1 solution that might need a hack. That is using the z-index to display a flash movie over your website for an advert, then "closing it" to a smaller advert on the page. Cause you'd HAVE to get that exactly right in all browsers you'd have to use absolute positioning there which'd force you to hack.

BAM! I found a reason for you .

Last edited by JustinStudios; Feb 6th, 2008 at 14:51.
Reply With Quote
  #31 (permalink)  
Old Feb 6th, 2008, 15:17
Junior Member
Join Date: Jan 2008
Location: UK
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

thanks , if you take a look at my site again http://www.firstbasedesign.co.uk/index_test.html

is there anyway i could refine the CSS code for my buttons , its just that i am thinking i have duplicate code , when its not really needed.

many thanks
Reply With Quote
  #32 (permalink)  
Old Feb 6th, 2008, 17:25
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: When is it ok to use Absolute Positioning ??

Quote:
Also sometimes to center in IE you gotta use text-align so make sure if you do use that you default your text back before you use it.
This should not be necessary for IE6+ (providing you're not triggering quirks mode).
Reply With Quote
Reply

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
positioning - relative or absolute? google Web Page Design 13 Nov 8th, 2007 16:00
absolute positioning micker Flash & Multimedia Forum 1 May 21st, 2007 19:17
Trouble with absolute positioning minerguy Web Page Design 4 May 26th, 2006 04:35
Rollovers and absolute positioning echo Web Page Design 5 May 2nd, 2006 10:51
absolute bottom positioning in all browsers stephenleefarmer Web Page Design 5 Dec 6th, 2005 23:19


All times are GMT. The time now is 16:27.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43