Click to See Complete Forum and Search --> : width or min-width


Dopple
05-29-2007, 05:13 AM
Hi guys. I'm just wondering when I should use width and when I should use min-width. I thought there wasn't really a difference but after a day messing around with a site layout trying to get stuff to fit together... I gueass I was wrong.

timdenty
05-29-2007, 06:12 AM
Well, the main difference is that older browsers (IE6 and earlier I think) don't recognize the min-width feature. Try looking at this article too - http://www.mezzoblue.com/archives/2004/02/25/sidestepping - it describes how to overcome this.

Also min-width is fluid when the window size is larger than your set value, whereas width is simply fixed.

Dopple
05-29-2007, 07:27 AM
Cheers. I have a site that's needing a complete redesign. I laid it out with absolutely positioned divs, and now I'm being asked to center it all. I guess that's what I get for cutting corners eh?
Lesson learned!

timdenty
05-29-2007, 08:52 AM
Just a thought - You could still use absolute positioning & have it center aligned. You would just have to have all your elements within a container which was relatively positioned with correct margins like this...

margin: 0 auto;
position: relative;

The child elements then take their position from the parent element (container), not the body.

Dopple
05-29-2007, 10:22 AM
Cheers Tim. That sure does beat the hell out of a complete re-coding.
Much appreciated!:D

felgall
05-29-2007, 02:41 PM
using absolute positioning unless elements are to overlap is unnecessary and just makes the coding much more complex. You can't centre absolutely positioned elements because they are positioned relative to a single location, not multiple locations..

Dopple
06-04-2007, 06:43 AM
Really the layout I'm after can be put into 3 columns. It's not as tidy to code as I would have preferred but I've just gone with 3 floating columns and I just need to work out the positioning of things.