IE6 CSS 버그 고치기 귀찮을때…

오늘 또 열씨미 CSS를 만지다가 이런 경우가 발생했다…
항상 FireFox 기준으로 디버깅을 하기때문에..

FireFox에서는 잘 나오는데… IE6 에서 특정 CSS 한줄이 제대로 안나오는 것이다..ㅎㅎ

TAB 브라이징 을 위한 탭을 만들고 있는중인데…

#tab
{
    float: left;
    display:inline;
    width: 70%;
    margin-left: 1%;
    padding: 0 0 20px 0px;
    height: 0px;
}

바로 저 패딩부분에서 문제가 생겼다.. float Layout 이기때문에 항상 문제가 생기는거 같다..-
여튼 저 한줄 패딩부분을 !important; padding: 0 0 0px 0px;
!important 를 주면,.. 즉,..
#tab
{
    float: left;
    display:inline;
    width: 70%;
    margin-left: 1%;
    padding: 0 0 20px 0px !important; padding: 0 0 0px 0px;
    height: 0px;
}

요렇게 적어주시면.. 내가 원하는 대로 나온다..

그런데,!!! 아주 중요한거.. 버그를 정말 고칠려고 맘먹고 하나하나 하다 보면…
#tab
{
    float: left;
    display:inline;
    width: 70%;
    margin-left: 1%;
    padding: 0 0 0px 0px;
    height: 0px;
}

걍 요렇게 해도 된다.. ㅋㅋㅋ

참고로 float 레이아웃에서 저 Height 는 IE6에서는 안 먹는거 같다.. –– 왜지???

왠지 삽질한 기분….
CSS 트릭 관련 링크

IE6 margin 버그 해결책

일단 해결책 부터 쉽게 말하자면 버그 나는 부분에 display: inline; 요한줄만 써주면된다..
문제의 발단은 float 를 IE가 제대로 뿌려주지 못하기 때문인거 같다.. 자세한 내용은 아래 영문 참조..
그냥 링크를 달려고 했으나.. 내가 자주 볼꺼 같아서 긁어왔다.. ㅋㅋㅋ

IE6 버그에 대한 주요 타이틀

The IE Doubled Float-Margin Bug

What Goes Wrong

A coder innocently places a left float into a container box, and uses a left margin on the float to push it away from the left side of the container. Seems pretty simple, right? Well it is until it’s viewed in Explorer for Windows. In that browser the left float margin has mysteriously been doubled in length!

The Way It Oughta Be

The graphic below shows a simple div (tan box) containing a left-floated div (green box) . The float has a left margin of “100px”, producing a 100px gap between the left edge of the container box and the left edge of the float box. So far so good.

.floatbox {
  float: left;
  width: 150px;
  height: 150px;
  margin: 5px 0 5px <span><font color="#dd0000">100px</font></span>; 
  /*This last value applies the 100px left margin */
  }

The Old IE “Doubletake”

That exact same code when viewed in IE/Win is displayed in a slightly different way. The graphic below shows what IE/Win does to the arrangement.

Why is this happening? Don’t ask such silly questions! This is IE, remember? Conformance with the specs is only to be hoped for, not expected. The simple fact is it does happen.

Important Points

This bug only occurs when the float margin goes in the same direction as the float and is trapped directly between the float and the inside edge of the container box. Any following floats with a similar margin won’t show the doubled margin. Only the first float in any given float row will suffer from the bug. Also, the doubled margin displays symmetry, working the same way to the right as it does to the left.

At Last, A Fix!

Up ’til now (Jan ’04) this bug was thought to be unfixable, and was generally controlled by replacing the faulty margin with a left padding on a non-visible float, along with a nested inner box to serve as the visible box within the invisible float, or by hacking a one-half margin value for IE/win only. It works, but is clunky and messes up the clean source code. Well that’s all over now.

Steve Clason has discovered a fix, outlined in his Guest Demo, that fixes both this doubled margin bug and a weird text indent bug as well. It’s a classic type of IE bug fix, using one property to cure a bug that affects an unrelated property.

So What Is It Already?

Dig this. Simply placing {display: inline;} on the float is all that is needed! Yup. Sounds too easy, don’t it? Nevertheless it’s true that a mere display declaration of “inline” is enough to do the job.

Those who are familiar with the specs on floats are aware that floats automatically become “block” elements, no matter what they were before becoming floats. As Steve points out from the W3C:

9.5.1 Positioning the float: the ‘float’ property

“This property specifies whether a box should float to the left, right, or not at all. It may be set for elements that generate boxes that are not absolutely positioned. The values of this property have the following meanings:

left
The element generates a block box that is floated to the left. Content flows on the right side of the box, starting at the top (subject to the ‘clear’ property). The ‘display’ is ignored, unless it has the value ‘none’.

right
Same as ‘left’, but content flows on the left side of the box, starting at the top.

none
The box is not floated. ”

That means that {display: inline;} on a float should be ignored, and indeed all browsers show no changes in the float when this is done, including IE. But, this does somehow trigger IE to stop doubling the float’s margin. Thus, this fix can be applied straight, without any fussy hiding methods. If a future browser decides to hiccup upon seeing this fix, just enclose the fix in an “IE only” Tan hack as detailed in the IE Three Pixel Text-Jog Demo.

Below are two live demos using the same code as previously, first displaying the IE bug as usual, and next the same demo with the “inline” fix applied to the float.

Float
Float,
with
{display: inline;}

.floatbox {
  float: left;
  width: 150px;
  height: 150px;
  margin: 5px 0 5px 100px; 
  <span><font color="#dd0000">display: inline;</font></span>
  }

Serendipity

You may notice that this bug fix idea is duplicated at the bottom of Steve’s demo page. Y’see, at the beginning of this episode Steve noticed the IE text indent bug and found the “inline” fix for it. He brought it to my (Big John’s) attention and since this was a cool bug with a fix, I then asked Steve to write it up as a “Guest Demo” for PIE. During the course of preparing the demo, Steve discovered that the fix also works to cure the Doubled Margin Bug, a much more common problem. Steve is a busy guy, and he asked me to write this “in depth” demo page to cover the fix while explaining the bug itself more completely.

I started the Guest Demo “program” primarily for encouraging others to focus their attentions on the various CSS display difficulties (and to avoid so much hard work for myself).

Well! Ah reckon it’s working accordin’ to plan. Way to go, Steve! 🙂

Holly ‘n John   Contact Holly Contact John ©positioniseverything
Last updated: January 19, 2004
Created January 19, 2004

현재 진행상황…

오랜만에 포스트를 남기는군…
요새 너무 바빴다도.. 아니고.. 계속 바쁘고 있는중이다..
아마도 다음달까지 여전히 바쁠듯…

당장 닥친건.. 짬뽕나 프로젝트랑… 졸업논문..
어서 마무리 지어야할껀.. IRS과제
서둘러 봐야할껀.. 동구권 과제…

그리고 예상하지 못하는 .. 영문과 과제..ㅜㅜ..

정말 하고 싶어서 하는건 짬뽕나 밖에 없구나.. 나머지는.. 먹고살기위해.. 졸업하기위해 하는것들..

맥북도 사놓고.. 바빠서 열어보지도 못하고 있다.. 애물단지..ㅜㅜ..
예전같았음.. 사놓고.. 한 일주일간 질리도록 가지고 놀텐데.. 가지고 놀정신도 없다..ㅎㅎㅎ

여튼…
오늘 짬뽕나 DB 등록 마무리했음..ㅋㅋㅋ
오늘 날 삽질하게 만든 MySQL과 우분투 미워할테다..ㅎㅎㅎ

-mysql 한글문제 해결한 방법과 mysql 원격 접속-
일단 설정 환경은…
서버용 우분투 7.04 버젼에..
MySQL 버전은 apt-get 으로 받은 Server version: 5.0.38-Ubuntu 버젼..
그리고 DB 접속하려는 클라이언트는 로컬이 아닌 외부IP의 Java 프로그램..

먼저, 원격 접속의 경우는.. /etc/mysql/my.cnf 에서..
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 203.253.22.151
#
이부분 주석처리 해주고…
우분투 리눅스에서 iptables 로 3306번 mysql 포트 방화벽 풀어줬다..

KIST안에서는 중앙네트웍에서 포트를 관리해서 그런지.. 안됐는데..
학교와서 해보니.. 아주 잘된다..ㅎㅎ

그리고 mysql은.. phpmyadmin 이것도 역시.. apt-get 으로 받아서.. 설치해놓고..
my.cnf 파일에 아래와 같이 설정 추가하고..
mysql의 데이타 베이스랑.. 테이블 모드 euckr_korean_ci 로 했더니 한글된다..ㅋㅋㅋ
———————————————————-
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock
default-character-set = euckr

[mysqld]
language        = /usr/share/mysql/korean

character-set-client-handshake=FALSE
init_connect=”SET collation_connection = euckr_korean_ci”
init_connect=”SET NAMES euckr”

default-character-set = euckr
character-set-server = euckr
collation-server = euckr_korean_ci

[mysqldump]
default-character-set = euckr

[mysql]
default-character-set = euckr
———————————————–
위에 같이 설정하고 나서 mysql 재시작하고..

mysql> status  해보면…
..
..
Server characterset:    euckr
Db     characterset:    euckr
Client characterset:    euckr
Conn.  characterset:    euckr
..
..

저렇게 euckr 로 설정되게 된다..
요렇게 되면.. 한글 설정 완료!!