Realizing css "min-width" style on IE 6.
enzoy : 쇠털나날/기계X꼬 - 개발자느낌 : 2011/07/29 14:56While trying to make a DIV which has a "all browser adaptable min-width",
I had to search and read some articles like these :
- realizing min-width in IE 6 : http://goo.gl/sjZcL (Korean Lang.)
- 9 Most Common IE Bugs and Fix : http://goo.gl/5LlJ5 (Korean Lang.) http://goo.gl/pLEy6 (Eng.)
- How to create an ie only stylesheet : http://goo.gl/1RVJ7 (Eng.)
- css expression: http://goo.gl/zfhIf (Korean Lang.)
But, all of them were slightly insufficient and not working on real Internet Explorer 6.
So, I had to research on it and make some combination pizza from those articles.
Here is the result ::
[HTML source for the DIV which has min-width available for all the browser]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
<style type="text/css">
#bodywrap {
width:99%;
min-width:640px;
margin:0;
padding:0;
border:1px solid black;
}
</style>
</head>
<body>
<div id="bodywrap">
Put some contents here.
</div>
<!--[if lte IE 6]>
<script>
window.onload=function() {
var obj = document.getElementById('bodywrap');
if (obj.clientWidth<640) obj.style.width='640px';
}
</script>
<![endif]-->
</body>
</html>
P.S. in addition, you can input some 1dot transparent GIF (eg. spacer.gif) to make a strut-bar for IE4 or IE3 or IE2 ... like this.
<img src="/images/spacer.gif" height="1" width="650">
Trackback Address :: http://blog.enzoy.pe.kr/trackback/705







