This is the DOC file for the mystudents.php problem: how to do a gallery pic layout for N students, enforcing equal pic width. ===== ToDo: 1) Assemble all test results here, to address the problem and about CSS etc. issues explored in extension of that. 2) Edit this file i.e. process odd notes, del. unnecessary ones. 3) Move it into more general DOC ------------------------- PROBLEM In my script mystudents.php, I'm having trouble getting pic.s to display at the best width under all conditions. This gets at a need for deeper understanding (and manipulation) of how CSS etc. work out widths. This DOC is about that k. ORDINARY CASE of setting width of pics Say nothing of width and it displays the pic at its original (pic-file specified) size. Or fix width, and it scales pic down to that size. It would scale it up too, but that isn't how I've used it normally. THIS CASE I have not 1 but 3+ constraints I'd ideally like satisfied: a) Fix cell width to be 1/N of window width; [TD width:x%] a2. Have pic no bigger than that width. [IMG max-width = 100%] b) Don't allow pic to scale up from its intrinsic size, only down. [done by (a2), and auto] c) Otherwise, have pic as big as possible [auto for IMG width] d) ?Have all pics in same row, scaled by same amount? i.e. find width of all in a row, and impose min(of all widths) e) Have pics no bigger than an abs amount. SOLUTIONS Warning: it may be the width, not of IMG, but of the legend. Setting TD width=100% gets (a) right behaviour rel. to page Setting IMG max-width:100% gets (a2), and using max-width not width there gets (b). [e.g. style="width:auto; max-width:100%;" ] Leaving IMG width:auto means it's as big as possible otherwise. Enclosing IMG in DIV, with max-width: 80px sets a second ORed constraint, so none of pics get too big. If I want tables full width always, that's it. If I want table narrower if pic constraints don't need full width, then? calc TD width using the 80px max rather than 100% as table width. If I want (d) all pics on a row same size, then ? need java to look at widths. UNITs % means percent of the width of DOM-enclosing element. i.e. includes inherit. em works in that it reacts to it; but doesn't seem right scale. 5em seemed about 10 chars wide. PROPERTIES (1: notes) 'auto' value: Setting L,R margins to 'auto' centers a box. *If you set abs. positions to all 4 corners/sides of a box (DIV) then it stretches the size (width,height) of the box. It computes width (height) from sides, if auto for width. And overflow:hidden. *Spec width, leave height to be calc. *set , or in