By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,788 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,788 IT Pros & Developers. It's quick & easy.

min-width in IE6?

P: n/a
Hi all,

I'm checking to see if anyone knows of a hack or trick or whatever to
get IE6 to keep a minimum width of a tableless page. I have the
entire page content wrapped in a container div called bodywrap that
sets the min-width to 760px and I added the spacer.gif for IE5.x and
NN4 in the body of the html and added the trick suggested here:
http://www.svendtofte.com/code/max_width_in_ie The trick worked when
IE6 was running in quirks mode, but in standards mode it doesn't.
BTW, my code can't be XHTML compliant because I'm creating templates
for other people to maintain who wouldn't have any idea how to do
that. This works in IE5.5, NN7 and Opera7. Here is what my relevant
code looks like:

Doctype...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

Styles...

body {
margin: 0;
padding: 0;
background: #FFFFFF;
color: #000000;
}
/* need this so the browser won't squish the content smaller than
760px */
#bodywrap {
width: 100%;
min-width: 760px;
/* hack for stupid IE6 */
width:expression(document.body.clientWidth < 760? "760px": "auto" );
}

Code...
<body>
<div id="bodywrap">
<!-- hack so IE5.x and NN4.x will keep a minimum width -->
<img src="images/spacer.gif" width="760" height="1">
Jul 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
hg*****@bcbsal.org (Holli Graham) wrote:
I'm checking to see if anyone knows of a hack or trick or whatever to
get IE6 to keep a minimum width of a tableless page.
Why on &Planet; would you do that? I can see the point in setting a
_maximum_ width, but do you really want to force horizontal scrolling
whenever the canvas width is less than 760 pixels (or, on print, chopping
off the ends of lines)?
I have the
entire page content wrapped in a container div called bodywrap that
sets the min-width to 760px and I added the spacer.gif - -
If you are playing with _such_ hacks, I don't really see what the problem
is, technically. If your document simply contains a 760 pixels wide image,
why wouldn't a browser make the document at least 760 pixels wide? (This is
really a _problem_ rather than a solution in any normal case, but I already
told that.) As usual, if we could see the URL...
BTW, my code can't be XHTML compliant because I'm creating templates
for other people to maintain who wouldn't have any idea how to do
that.
I'm afraid you are seriously misguided. Especially if people who maintain
the pages don't understand markup issues, you should create valid markup for
them.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">


Why do say that if you know that the markup "cannot" be valid? Surely if it
can be valid HTML, it's very trivial to make it valid XHTML (if you know
what XHTML actually is).

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #2

P: n/a
I guess I should've specified "NO LECTURES PLEASE!"

I didn't come here for a lecture. I came here to find out if any css
gurus might know the solution to my problem. Sorry, I don't have a
public site to test on, but I pasted the relevant html. I can always
copy and paste the whole thing, but I don't think that's necessary.

And, FYI, putting a hack spacer gif at the top of your document keeps
a horizontal scroll bar, but still lets all the floats and everything
underneath it stack on top of each other.

So, does anyone have a solution to the IE6 min-width problem?

Thanks!
Holli

"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message news:<Xn*****************************@193.229.0.31 >...
hg*****@bcbsal.org (Holli Graham) wrote:
I'm checking to see if anyone knows of a hack or trick or whatever to
get IE6 to keep a minimum width of a tableless page.


Why on &Planet; would you do that? I can see the point in setting a
_maximum_ width, but do you really want to force horizontal scrolling
whenever the canvas width is less than 760 pixels (or, on print, chopping
off the ends of lines)?
I have the
entire page content wrapped in a container div called bodywrap that
sets the min-width to 760px and I added the spacer.gif - -


If you are playing with _such_ hacks, I don't really see what the problem
is, technically. If your document simply contains a 760 pixels wide image,
why wouldn't a browser make the document at least 760 pixels wide? (This is
really a _problem_ rather than a solution in any normal case, but I already
told that.) As usual, if we could see the URL...
BTW, my code can't be XHTML compliant because I'm creating templates
for other people to maintain who wouldn't have any idea how to do
that.


I'm afraid you are seriously misguided. Especially if people who maintain
the pages don't understand markup issues, you should create valid markup for
them.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">


Why do say that if you know that the markup "cannot" be valid? Surely if it
can be valid HTML, it's very trivial to make it valid XHTML (if you know
what XHTML actually is).

Jul 20 '05 #3

P: n/a
How am I supposed to post my replies in a newsgroup?:
http://allmyfaqs.com/faq.pl?How_to_post

Holli Graham wrote:
I guess I should've specified "NO LECTURES PLEASE!"
And what would that have accomplished?
I didn't come here for a lecture. I came here to find out if any css
gurus might know the solution to my problem. Sorry, I don't have a
public site to test on,
Are you authoring for the www? (That is the topic of this group.)
Create a test directory and post there.
So, does anyone have a solution to the IE6 min-width problem?


As you already appear to know, IE/Win ignores min and max width and
height. The best solution I can think to offer you is to rethink your
approach, design flexibly, and don't try to specify a min-width on the
page. It is terrible for usability.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #4

P: n/a
Holli Graham wrote:
Hi all,

I'm checking to see if anyone knows of a hack or trick or whatever to
get IE6 to keep a minimum width of a tableless page. I have the
entire page content wrapped in a container div called bodywrap that
sets the min-width to 760px and I added the spacer.gif for IE5.x and
NN4 in the body of the html and added the trick suggested here:
http://www.svendtofte.com/code/max_width_in_ie The trick worked when
IE6 was running in quirks mode, but in standards mode it doesn't.
BTW, my code can't be XHTML compliant because I'm creating templates
for other people to maintain who wouldn't have any idea how to do
that. This works in IE5.5, NN7 and Opera7. Here is what my relevant
code looks like:


In strict-mode, IE6 takes the wrapping element's width and if an image
in the content is larger than it, it still resizes the rest of the
contained elements to the wrapping width. In quirks mode or older
versions of the browser, it resizes all the preceding and following
elements to the width of the overlarge image. AFAIK min- and max-width
properties are altogether ignored. Just setting a width and getting rid
of the spacer-gif should work, or doesn't it? And are you sure you want
to support broken NN4?
Jul 20 '05 #5

P: n/a
On Mon, 24 Nov 2003, Holli Graham blurted out atop a fullquote:
I guess I should've specified "NO LECTURES PLEASE!"


I guess we should have recognised right away that you came here for a
free handout, rather than to participate in a usenet discussion.
Jul 20 '05 #6

P: n/a
Thanks for explaining that Philipp. IE6 just hasn't caught up with
the other browsers yet and doesn't support the min-width property.
Hopefully, they'll support it in the next version. IE6 does now
support min-height if you're wondering, although I can't think of a
use for that off the top of my head. Unfortunately, I don't have a
lot of control where I work. I can suggest things, but I have no
direct control over anything once the templates leave my hands. It
has been a struggle trying to convince everyone that we need to be
more accessible and move toward standards coding. A lot of these
people worked in print for years and want things to look "just so."
And, yes, we still have to code for NN4, but, hopefully, not for much
longer. I have alternate styles for that and print, so that's okay.
Maintaining a min-width is a small compromise to make for them to
agree to tableless, liquid layouts, and allow font resizing. Maybe in
the next redesign, we can get everyone using XHTML. :)

I did find a javascript hack that will make the min-width property
work in IE browsers. With a little tweaking, I was able to use it and
delete the spacer.gif. It won't work for NN4 users or people with
javascript turned off, but that's okay. That's a small percentage of
people, and they'll still be able to see the page without any trouble.
For anyone searching this newsgroup for answers to this question who
don't want to endure a tongue lashing. The js hack I mentioned is
explained here: http://forums.devshed.com/t45964/s.html

Thanks again for your help Philipp!
Holli

"Philipp Lenssen" <in**@outer-court.com> wrote in message news:<bp*************@ID-203055.news.uni-berlin.de>...
Holli Graham wrote:
Hi all,

I'm checking to see if anyone knows of a hack or trick or whatever to
get IE6 to keep a minimum width of a tableless page. I have the
entire page content wrapped in a container div called bodywrap that
sets the min-width to 760px and I added the spacer.gif for IE5.x and
NN4 in the body of the html and added the trick suggested here:
http://www.svendtofte.com/code/max_width_in_ie The trick worked when
IE6 was running in quirks mode, but in standards mode it doesn't.
BTW, my code can't be XHTML compliant because I'm creating templates
for other people to maintain who wouldn't have any idea how to do
that. This works in IE5.5, NN7 and Opera7. Here is what my relevant
code looks like:


In strict-mode, IE6 takes the wrapping element's width and if an image
in the content is larger than it, it still resizes the rest of the
contained elements to the wrapping width. In quirks mode or older
versions of the browser, it resizes all the preceding and following
elements to the width of the overlarge image. AFAIK min- and max-width
properties are altogether ignored. Just setting a width and getting rid
of the spacer-gif should work, or doesn't it? And are you sure you want
to support broken NN4?

Jul 20 '05 #7

P: n/a
On 24 Nov 2003 06:58:48 -0800, Holli Graham wrote:
I guess I should've specified "NO LECTURES PLEASE!"


Sometimes, listening to a lecture is the price for gaining free advice.

Would it really kill you to nod politely and perhaps counter with your
position rather than rudely tell someone that is offering you advice that
you want to dictate the terms they can offer it under?

Does having to read a lecture cause you physical pain and discomfort such
that it's impossible for you to ignore or even *gasp* consider it?

Yes, I'm being sarcastic, and perhaps even lecturing a little myself. But
it does irk me that you can ask for advice and then be rude to the people
that offer it to you.
Jul 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.