Posted By

roberocity on 07/09/06


Tagged

hack minmax ie6


Versions (?)

Who likes this?

167 people have marked this snippet as a favorite

designerd
joernba
katxorro70
mate
meth
postNuKe
kaminogoya
panatlantica
dertimbo
pocorn
fatihturan
markfavazza
marza
billtaichi
yu_industries
aznprncritic
dmarten
Sahoglu
Poltras
tavo
icarus
hollowmyth
manub
robotoverlord
rich13
marcoba
jonhenshaw
vali29
heinz1959
candes
pagetoscreen
aziz
hariharank12
Winkyboy
willgarrison
visuallyspun
kaiser79
arala22
marcio
vasya1905
jbreen
seekup00
avioli
stphnclysmth
vbert
snucko
wbowers
maddesigns
gbot
gtalmes
chill3d
sgiberson
shalo
themolitor
digitalifer
stylz
alvaroisorna
juliend2
JustinCrossman
overhang
Mithun
riz
pablodgavilan
wizard04
bassdas
nickdoherty
apawson
esquareda
aleprieto
inkdeep
titox
hanguofeng
poGDI
Wiederkehr
rubensarrio
chrisaiv
asturi
crisb
l1r
Jman
LostCore
adesignapart
tobiasmay
Nix
yuindustries
brother_maynard
elbuenob
ntulip
enajenkins
windmarble
tewoos
owais
hamiltonmascioli
bigheadlyf
johnloy
bakin9
gerhardsletten
delarge
fragmentist
nb109
thatryan
shikkaba
moussin
tanathos
Jamie
exentrich
acosonic
MazheM
jaff
isdereks
marvin_speakman
The14thGOD
lexpresso
ruhanirabin
darkapple
bigredjoe
webtronix
eivind
dancrew32
metoikos
delikassap
redstorm
kblair
tariel
smvnet
colingardom
elundmark
sethetter
osirisinternet
crispunk
JayNL
daubu
pchengsf
shalomfriss
ljayz
czterystaczwarty
naeemnur
seanpowell
bobbym245
martins
chris5marsh
Moonsheeld
kewah
tspitzr
aegony
garthhumphreys
charlesp1138
amplitude
mrplantain
michellebracken
fauverism
intothelight
jillella
wearefreya
albertomori
bostonbasso
qubestream
benediktvaldez
jumichot
SpinZ
macodev
jafar
leobetosouza
arunpjohny
phongjalvn
felicemente
atulkransingh


min/max-width fix for IE6


 / Published in: CSS
 

Javascript expression in css to allow for min/max widths. replaces the min-width, max-width that works for IE6.

  1. #content {
  2. height: 75px;
  3. background-color: #000;
  4. color: #fff;
  5. width: expression(document.body.clientWidth < 742? "740px" : document.body.clientWidth > 1202? "1200px" : "auto");
  6. min-width: 740px;
  7. max-width: 1200px;
  8. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: gpenston on July 21, 2009

This is actually cited as being bad for performance in High Performance Web Sites (YSlow dev group).

Posted By: Jamie on July 28, 2009

I have used this before, and yes it's slow, but when the design depends on min/max-width it does the trick.

Posted By: bucabay on September 3, 2009

You really should use IE conditional comments to limit the use of the expression() function to IE6 and earlier. IE7 and IE8 both support min-max width. I don't believe CSS validators will validate expression() also. Here is a reference to the use of expression to emulate min/max dimensions in CSS: max-width-and-min-width-support-for-ie

Posted By: Ahrjay on September 17, 2009

I added a pure CSS based min-width example for IE6 http://snipplr.com/view/19887/pure-css-ie6-minwidth/

You need to login to post a comment.