Ethan said:
This page has some good info for using CSS to do just this:
http://www.svendtofte.com/code/max_width_in_ie/
as IE a problem child in dealing with the max-width tag.
Excellent thanks. They say studies suggest 60 characters per
line is ideal, less for children. The page looks like about
100 characters though <g>.
Here's the basic css tag (which doesn't work in IE):
<p style="min-width: 25em; max-width:33em;">
[alot of text goes here]
</p>
http://www.maxdesign.com.au/presentation/em/flexible.htm
Ah, now I see why em's are a useful unit! Lets you set the
width according to the size of the letters, no matter what
font settings the user chooses. An em is the size of a capital
letter 'M' or the same as the point size: "For example, in
12-point type, an em is a distance of 12 points"
Something like 420 pixels is optimal for a standard browser
with 14-16px fonts but you never know what people do to
their settings.
The link above uses a tricky MS java script kind of way of
replicating this effect in IE with the expression() property:
<html>
<style>
p {
border:1px solid red;
max-width:30em;
min-width: 15em;
width:expression(
document.body.clientWidth > (500/12) *
parseInt(document.body.currentStyle.fontSize)?
"30em":
"auto" );
}
</style>
<body>
<p>
[alot of text]
</p>
</body>
</html>
I added the line
min-width: 15em;
or else it won't shrink in mozilla, which was my original question. I
assume this will work with tables also.
here it is without that line:
http://www.svendtofte.com/code/max_width_in_ie/max_width_final.html
OK, now I've played around with this on my own and the problem is that I
want to left adjust a paragraph but center the block. I've got the css
setting this up for a <div>. Basic question but is there a wrapper I can
put around the whole thing to center it (besides a table <g>)? I did it
with a table here:
http://www.edgehill.net/html/css/max-min-width.htm
but now it's got something funny in Mozilla where it won't make a scroll
bar if I shrink my window down tiny. Sheesh, it's always something. I
just learned I can take the formatting out of the table and it works the
same, simply having the table as a container allows that to be centered
and the div inside sets the width.