Welcome to WebmasterWorld Guest from 54.197.171.28

Forum Moderators: not2easy

Message Too Old, No Replies

Absolute positioning bad?

absolute positioning checkbox

   
5:22 pm on Jan 7, 2009 (gmt 0)

5+ Year Member



Hey all,

I have a 300 x 200 div floated in my page, nested a few div's thick. The div is for username/password to log-into my site. It is typical layout....

user: [__________________]
pass: [__________________]
[] remember me login

Based on research I've seen various opinion's on ways to do this, including:
- <p> tags per row
- <div> tags per row
- absolute positioning

So far I have not seen arguments to support any opinions, just (usually strong, sometimes negative) opinions. I want to ask... is absolute positioning bad? If so, why?

I should mention, I still haven't quite gotten an epiphany with CSS/html as to how you structure your page (getting there, but not quite yet) so bear with me if this is too remedial.

Thx,
Rob

6:56 pm on Jan 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think that most who would reply would have their own opinions regarding your question. In regards to absolute positioning.

It is just a matter of how they style their sites.

I prefer to use a fixed width with floats within. Just my preference.

If you are just starting out with css, You could do many searches within WebmasterWorld to get information. I'm sure if you searched absolute positioning, you will find a few discussions in regards to it. Also check out WebmasterWorld's library, it is filled with information.

And, of course, don't' forget to Google things that you might have questions about.

7:39 pm on Jan 7, 2009 (gmt 0)

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



These things are as always just an opinion:

I like to use other tags than <div>, I consider an overuse of <div> just as bad as using <table> for layout.
I prefer the html to make sense without the CSS.

Absolute positioning, relative positioning, just go with the flow, use margins and padding, or floats: they all have their place and all can be used to achieve something, which you choose is bottom line your choice. It's hard to label one better than the other. Use the right tool for the task at hand.

8:59 am on Jan 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Absolute positioning can be one of the hardest things to get working right in all browsers, so I tend to avoid it unless really needed.

Perhaps when (if) IE6 ever goes away it will be more useful, but for now it can cause issues.

3:31 pm on Jan 8, 2009 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I have a 300 x 200 div floated in my page.....

I think the largest opposition to absolute positioning is inherent in your question - it nearly always goes hand in hand with pixel sizing of elements and text (although you can position absolutely without pixel sizing . . . )

When you specify an element by pixel size, you're likely to also specify the text by pixel size, which can produce unexpected results with varying monitor resolutions - an 11px type size will reduce to infinity on a high rez monitor.

Second, it's most likely related to accessibility. A good rule of thumb is to design/develop so that the layout will either adapt or degrade gracefully for any user environment or browser. Someone should be able to increase/decrease text size, use their own style sheets or at least set background colors without your layout falling apart. Absolute positioning and pixel-perfect assignments tend to fall apart when you apply these environment changes.

11:01 pm on Jan 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have gone to using pretty much only em's and %, but that has it's issues too in some instances, especially when you get into "cascading ems" with nested divs.

It would be simple if all browsers and all monitors worked the same :(

3:22 pm on Jan 9, 2009 (gmt 0)

10+ Year Member



Personally in your case I would use none of your options and instead style the form using its own attributes (form, fieldset, input etc).
 

Featured Threads

Hot Threads This Week

Hot Threads This Month