Realizing css "min-width" style on IE 6.

enzoy : 쇠털나날/기계X꼬 - 개발자느낌 : 2011/07/29 14:56

While trying to make a DIV which has a "all browser adaptable min-width",
I had to search and read some articles like these :

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">


Tags (관련 유사 이야기거리들) :

Trackback Address :: http://blog.enzoy.pe.kr/trackback/705


    Comment(s) :

Write a comment


<< : [1] : >>

광고란