View Full Version : minimum width for div

10-11-2002, 07:37 AM
I feel like i'm swamping this board with questions... I really am trying to figure them out myself I promise, I (literally) haven't moved for 7 hours ... :p

today's questions is about minimum width in a div.

I have 3 images in a row inside a div, which provides a border for the page. I need to make it so that when the page is resized the div stops contracting before the images overlap and makes the image go down a line.

In explorer that can be done with a spacer image... but in Mozilla and Opera the spacer image doesn't stop the div from contracting.

I couldn't find another way to do it.


P.S. I might mention also that I need the div to use percentages, so I can't just specify a hard width via pixels... not that easy

10-11-2002, 08:53 AM
Not really. You can find 'minwidth' and 'maxwidth' in the specs but it's not supported yet.
A trick would be to make one large image and maybe slice it horizontally 'to make it load faster', but that would be the same as giving the div an absolute width and make the page less flexible.
Two links to get you through the weekend:
In case you're going to specify absolute widths http://www.tantek.com/CSS/Examples/boxmodelhack.html
Boxes: http://www.thenoodleincident.com/tutorials/box_lesson/

10-11-2002, 09:52 AM
What if You put all Your images in a table cell with nowrap attribute? The table itself will be contained by the DIV. This should stop the DIV from contracting more than needed...


10-11-2002, 10:50 AM
Just an idea, maybe it's worth to experiment with. Setting relative sizes on images?
This works in IE, Moz and Opera on Mac.

<style type="text/css">
div {
img {
br {
<img src="" />
<img src="" /><br />

10-13-2002, 11:43 PM
ah! I have wasted way too much time trying to recreate my old site using validating code and no tables... it was a really good learning experience but one thing I realized is that you can't look at webpages the same way as you used to when you're designing with standards in mind.
A lot of good pages online say stuff like "the web is not print, and it's not screen, so don't try to design with pixel precision"

So i'm giving up my quest to recreate my old page to the "t", and instead i'm using a set width box model using the hacks found here:

It is not as flexible as my old design, but it does what I want and still looks good... so that's how it will be. Still i'm a little perterbed that I wasn't able to recreate a fairly simple design with the help of many tutorials, and great input from everyone here.


10-14-2002, 11:04 AM
Originally posted by MCookie
Not really. You can find 'minwidth' and 'maxwidth' in the specs but it's not supported yet.

http://www.xs4all.nl/~ppk/css2tests/width.html :rolleyes: