View Full Version : min-width in IE

07-14-2008, 03:42 PM
I found a work-around for the min-width problem in IE, my problem is I don't quite know how to implement it.

* html div#division {
width: expression( document.body.clientWidth < 334 ? "333px" : "auto" ); /* set min-width for IE */
min-width: 333px; /* sets min-width value for all standards-compliant browsers */

Does the * html mean that this is good in the whole document?

And I'm not too sure what the div#division is for.

It's probably stupidly simple, I just kind of new to CSS and don't have all the protocol down yet.

07-14-2008, 03:50 PM
any thing with

* html

in it is applying it to the whole document that has the style sheet applied to it

"*" that is basically universal.

Which site did you find this at, not sure what they are defining as "division", if you could give us a link we could take a look.

you can also lay it out like this

* html #division

you dont need the div.

07-14-2008, 03:55 PM
You may find this useful. (http://www.cssplay.co.uk/boxes/minwidth.html):D

Or even this. (http://exitfegs.co.uk/IEBugs.html)


07-14-2008, 04:06 PM
Here is where the code originated:

I've seen some other solutions, but they involve JavaScript and are very long and involved.

This looks to be the simplest.

I wondered about the div. Just wasn't sure.

Thanks for the links.

I appreciate the help. (and am astounded at the quick response! :thumbsup:)

07-14-2008, 04:16 PM
well, from the looks of it they are just definging thier own div. I didnt know if it explained a certain div to use in your html. So you should be able to just name it whatever you want.

07-14-2008, 04:18 PM

I have used the following "universal reset" which appears to cause odd problems.

EDIT: Worth a try just to see what it does.



07-14-2008, 04:20 PM
I have never seen that before


what does CSS do with "*" as a property?

EDIT** Sorry j1adobe i forgot to mention as a side not that "* html" i believe targets IE only..

07-14-2008, 04:27 PM
I have used the following "universal reset" which appears to work.


Always looking to learn. What does this mean?

07-14-2008, 04:28 PM

Sorry, This is out of place here.
Just doodling. I was wondering if the universal selector "*"was itself universal.


07-14-2008, 04:34 PM
As JC said, the * makes it universal. The things following it make it less universal, however. The "div" makes it apply to all <div> tags unless specifically refuted somewhere else. The "#division" is a specific with some object (a div most likely) identifying it. Only one can legally exist as the "#" makes it very specific.

07-14-2008, 05:05 PM
And I'm not too sure what the div#division is for.
See, if I have a CSS

The above rule is applicable to all elements having a class="mystyle", say

<div class="mystyle">some text here</div>
<p class="mystyle">some other text here</p>
<span class="mystyle"> even more ....</span>

Now, If I want to change the background color of that <div> only , I can't apply it directly to the .mystyle selector, since it will change the behavior of my other elements having the same class.

The solution is

div.mystyle{ /*no space between div and dot */

(if we put some space before that dot, div .mystyle , then it'll become a different rule)

Similarly div#mystyle explicitly specifies that this particular rule is applicable to a <div> having id="mystyle".

Since, it's not possible to have more than one element with same value for id in a single document, we can interchangeably use div#mystyle or #mystyle

But, if it's an external style sheet, shared by more than one document, both of them can play different roles on different pages.

After all, sometimes I prefer to use div#mystyle even if there is no element in any of the pages having an id="mystyle", so as to easily convey that my element with id="mystyle" is <div>