473,394 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Max-Width property in IE 6

Hi

First I must apologise to Mr. Dorayme for my use of his web-page as the
example for my question. In order assist in making him feel better I'll
mention it is an excellent article.

However what I am enquiring about is how to make what he has done work in
IE 6.

Here is the web-page:
http://members.optushome.com.au/droo...LawsFixed.html

and here is the css:
http://members.optushome.com.au/droo...gLawsFixed.css

It is the declaration of max-width: 600px in the div selector that I'm
enquiring about.

Here it is in context:

div {
max-width: 600px;
margin-top: 30px;
margin-left : auto;
margin-right : auto;
border: 5px solid #ccc;
padding: 30px;
padding-top: 10px;
color : #000;
background-color : #FFF;
}

If you look at this web page in Firefox, Safari, OmniWeb or Camino what
you'll see is that the text of the article is in a box 600 px wide. If you
widen the window of the browser then the margins get wider but the text
area remains in the centre, 600 px in width.

If you narrow the browser window to less than 600 px then the margins
disappear and the central text area starts to narrow so that the text is
now wrapping to the width of the browser window.

Key to all of this is the use of the declarations:

margin-left : auto;
margin-right : auto;

as well as max-width: 600px.

Okay so all is well with the world until you open the web-page in IE 6. Now
you will see that max-width, margin-left, margin-right properties have been
ignored and the article text is simply filling the browser window and
wrapping against the right of the window no matter how wide that window is.
My question obviously is can the max-width property be made to work in IE 6
such that Dorayme's web-page will work in IE 6 as it does in every other
browser I've tried?

Thank you :)

--
Patrick
Brighton, UK

Oct 14 '06 #1
4 5203
On Sat, 14 Oct 2006 14:49:09 +0100, patrick j
<pa*****@jamesnews.orangehome.co.ukwrote:
>Okay so all is well with the world until you open the web-page in IE 6. Now
you will see that max-width, margin-left, margin-right properties have been
ignored and the article text is simply filling the browser window and
wrapping against the right of the window no matter how wide that window is.
My question obviously is can the max-width property be made to work in IE 6
such that Dorayme's web-page will work in IE 6 as it does in every other
browser I've tried?
There is a horrible IE kludge which can be made to work in reasonably
simple pages: http://www.svendtofte.com/code/max_width_in_ie/

Incidentally don't size the column in pixels as the example you took
did. Use ems as this page shows.

I suggest you put it in a separate stylesheet which is only linked for
IE using IE conditional comments.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Oct 14 '06 #2
In article
<00*****************************@News.Individual.N et>,
patrick j <pa*****@jamesnews.orangehome.co.ukwrote:
Here is the web-page:
http://members.optushome.com.au/droo...LawsFixed.html

and here is the css:
http://members.optushome.com.au/droo...gLawsFixed.css

It is the declaration of max-width: 600px in the div selector that I'm
enquiring about.

Here it is in context:

div {
max-width: 600px;
margin-top: 30px;
margin-left : auto;
....
My question obviously is can the max-width property be made to work in IE 6
such that Dorayme's web-page will work in IE 6 as it does in every other
browser I've tried?
Since posting this version of the CSS at ...Fixed.html, max-width
was changed to width="600px" to properly illustrate the
difference between:

<http://members.optushome.com.au/droo...ugLawsFixed.ht
ml>

and

<http://members.optushome.com.au/droovies/opinion/drugLaws.html>

the latter using max-width in ems.

Aside from the point of the comparison for now, but my response
to your intelligent question about IE and max-width and the
display of this sort of pure text article is this. I would make a
style sheet for IE 5 and 6's eyes only and in that style sheet.
In that CSS, depending on my mood, simply let IE users see it as
fixed 600 or 800px wide or a guessed-by-me-as-being-suitable but
definite (width: rather than max-width:) number of ems.

Indeed, there are so many ways to go that it is hard to say which
is best. But, essentially, in a case like this, it is not worth
employing over fancy tricks for IE like javascript when a mere
"for IE eyes only" clause in the CSS or separate sheet will do.

You may find this article helpful to start with:

http://www.gunlaug.no/contents/wd_additions_14.html

--
dorayme
Oct 14 '06 #3
On Sat, 14 Oct 2006 22:14:48 +0100, dorayme wrote
(in article
<do**********************************@news-vip.optusnet.com.au>):
Since posting this version of the CSS at ...Fixed.html, max-width
was changed to width="600px" to properly illustrate the
difference between:

<http://members.optushome.com.au/droo...ugLawsFixed.ht
ml>

and

<http://members.optushome.com.au/droovies/opinion/drugLaws.html>

the latter using max-width in ems.
Yes I appreciate indeed your intention of posting the pages and it was
very informative for me.

In fact I did not know that the max-width property existed in CSS and
it was at your pages that I noticed it.

This is the problem with trying to pick up CSS bit-by-bit from various
web-sites - I miss things.

Anyway I've got Eric Meyer's books on the way to me now from Amazon.

For some time I'd been wondering if it was possible with CSS to create
margins that collapse first (as browser window narrows) then for the
central text containing area to become one that narrows when browser
window demands.

This was never a problem with old school table layouts. Anyway I saw
your web-pages and I was pleased to see the existence of the
"max-width" property and the "margin: auto;" declarations.

I did some experimentation with this and discovered that while it works
excellently on every browser on my Mac it won't work with IE 6 :(
Aside from the point of the comparison for now, but my response
to your intelligent question about IE and max-width and the
display of this sort of pure text article is this. I would make a
style sheet for IE 5 and 6's eyes only and in that style sheet.
Yes, this is what I'm going to do.

I don't like the text to be spread right across the browser window and
setting "hard" margins is too inflexible.

I know there is a great deal of debate on the issue of width of text
and there are those who say that the user can simply narrow the browser
window if need be. Unfortunately the reality is that most people just
don't seem to do that. If they are using a PC then the browser window
is simply at the max width of their screen.

On the Mac of course the browser does not fill the screen in that
manner as a default behaviour.

Unfortunately with the PCs people seem very often to simply have the
browser window filling the whole screen. I fully understand that most
PC users on this newsgroup will not do that but I spend 2.5 days a week
in a University which is nearly 100% PCs in the offices and every
single one simply has the browser window at the maximum width of the
screen no matter how wide the screen.
In that CSS, depending on my mood, simply let IE users see it as
fixed 600 or 800px wide or a guessed-by-me-as-being-suitable but
definite (width: rather than max-width:) number of ems.

Indeed, there are so many ways to go that it is hard to say which
is best. But, essentially, in a case like this, it is not worth
employing over fancy tricks for IE like javascript when a mere
"for IE eyes only" clause in the CSS or separate sheet will do.
I agree, the Javascript route looks too complicated.

I think for my situation I will create a separate style-sheet for IE
with either fixed margins or a fixed central text area.

Then I can have my much more liquid style-sheet for all other browsers.
--
Patrick
Brighton, UK

Oct 14 '06 #4
In article
<00*****************************@News.Individual.N et>,
patrick j <pa*****@jamesnews.orangehome.co.ukwrote:
I don't like the text to be spread right across the browser window and
setting "hard" margins is too inflexible.
If it is (especially) text only article that is being displayed,
one can use, eg. "width: 35em" which IE understands fine, no need
for any special instructions. And this will be fine for most
people. This is regarded as being not "fixed" but "fluid" because
of the em (which is dependent on the user's text-size setting for
the browser)

I experiment with max-width in these things sometimes to try to
overcome the shortcomings of even this. Take a look at what
happens when you put in the reasonable 35em for width (not
max-width) and pretend to be tired and want to sit back in the
chair and read it big... it can develop horiz scrollbars! It is
this sort of thing that can be stopped with max-width, this sets
a limit. And if you want this feature in IE, you need to do
special things. But you could take the attitude that the em based
width (no max-width) is good enough flexibility and if the user
uses an inadequate browser, then you are not going to jump
through hoops to add all the refinements for the few who would
want huge text size AND yet uses IE 5 and 6. Depends on how much
you care, how much you can be bothered.
On the Mac of course the browser does not fill the screen in that
manner as a default behaviour.
In some ways I have admired watching some expert PC users doing
all at full screen, using the equivalent of our silly dock to
switch about and so on... I have a PC and sort of understand it
but am too stuck in my Mac ways and like windows to be as
reasonable as the site calls for and no more...

--
dorayme
Oct 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steven Bethard | last post by:
So I've been playing around with trying to add a keyword argument to min and max that works similarly to the one for sorted. It wasn't too hard actually, but it does raise a few questions about...
2
by: Jack | last post by:
Greetings folks, Just curious if anyone knows what the following would produce: SELECT MAX( ECP_SUPPORT_DED_EMAIL.CD_TYP_CMPGN) CD_TYP_CMPGN, MAX(ECP_SUPPORT_DED_EMAIL.CELL_ID) CELL_ID,...
2
by: Pink Panther | last post by:
Using the following SQL can the results be explained? Using A97 (with the SP2 for Jet 3.5) or A2002 CREATE TABLE Test (PK Number CONSTRAINT PK_TEST PRIMARY KEY, ParentID Number, Child...
3
by: Ker | last post by:
I have a query that works great. It gives me the min for multiple fields. Within this query, I also need to get the max of some fields too. I currently have output of Date Name ...
8
by: charles.amith | last post by:
I have 2 tables: LOCATION and ELEVATION In location, I would like to find the record with the max value for field: DATE1 In elevation, I would like to find the record with the max value for...
61
by: norb1 | last post by:
After tracking down a bug in my Fortran program, I found that it assumed max(NaN,0.) = 0. This makes no sense, as the outcome of the operation is undefined and should be NaN. max(NaN,0.) = NaN...
6
by: mike | last post by:
so I keep optimizing my fields down to the minimum character length necessary i.e., varchar(15), then I find out a month later its gotta get bigger, then a few months later, bigger again, etc. ...
19
by: Eugeny Myunster | last post by:
I know, only simple one: #include <stdio.h> int main() { int min=0,max=0,i,arr; for(i=0;i<12;i++) arr=rand()%31-10; for(i=0;i<12;i++)
54
by: bearophileHUGS | last post by:
Empty Python lists don't know the type of the items it will contain, so this sounds strange: 0 Because that may be an empty sequence of someobject: 0 In a statically typed language in...
0
by: hong.niu4 | last post by:
please look our website ,have more mode shoes clothing hat cap bags ! Air Max Air Max 87 shoes www.shoestrade.biz Air Max 90 shoes www.shoestrade.biz Air Max 91 shoes www.shoestrade.biz Air...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.