Category
show
전체 (775)
웹표준, 웹접근성™ (5)
웹프로그래밍™ (360)
웹기획™ (0)
웹디자인™ (5)
서버™ (32)
데이터베이스™ (43)
개발자료 (9)
트랜드 (60)
Study English (2)
블루비 (70)
오피스 다이어리 (19)
Textcube (2)
이슈 (20)
컴퓨터 악세사리 (18)
엔터테인먼트 (24)
좋은글 (73)
재테크 (1)
이벤트 (4)

IE conditional comment hack

웹프로그래밍™/XHTML/CSS 2008/02/13 14:30 by 블루비 Total 1198 : Today 1 : Yesterday 2

Conditional comment syntax

The conditional comment is just a specially formatted HTML comment that is picked up only by various flavors of Internet Explorer for Windows. You could for instance use this to apply the PNG Behavior

The following conditional comment is being picked up by IE5, IE5.5 and IE6:

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie.css" />
<![endif]-->

Targeting IE5

If you need to target IE5 specifically, you do so by appending a version number:

<!--[if IE 5.0]>
<link rel="stylesheet" type="text/css" href="ie-5.0.css" />
<![endif]-->

Targeting IE5.5

If you specifically need to target IE5.5, it’d look like this:

<!--[if IE 5.5]>
<link rel="stylesheet" type="text/css" href="ie-5.5.css" />
<![endif]-->

Targeting IE6

The same goes for IE6:

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie-6.0.css" />
<![endif]-->

IE5 and IE5.5 - box model hacking

If you need to work around IE5’s broken box model, using conditional comments, you can use several alternative syntaxes.

The first syntax will apply the stylesheet to any version of IE whose version number starts with 5:

<!--[if IE 5]>
<link rel="stylesheet" type="text/css" href="ie-5.0+5.5.css" />
<![endif]-->

Alternatively, you could say that stylesheets should be applied to any IE version whose version number is less than 6:

<!--[if IE lt 6]>
<link rel="stylesheet" type="text/css" href="ie-5.0+5.5.css" />
<![endif]-->

Order

If you don’t want your IE-specific styles to be overridden by your regular stylesheet, source order is significant; you’d want to specify the common stylesheet first, with the IE-specific versions following:

<link rel="stylesheet" type="text/css" href="common.css" />

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie.css" />
<![endif]-->

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie-6.0.css" />
<![endif]-->

<!--[if IE lt 6]>
<link rel="stylesheet" type="text/css" href="ie-5.0+5.5.css" />
<![endif]-->


http://www.quirksmode.org/css/condcom.html

http://virtuelvis.com/archives/2004/02/css-ie-only

CSS hacks and filters


2008/02/13 14:30 2008/02/13 14:30

TRACKBACK :: http://blueb.net/blog/trackback/1092

Leave a Comment
[로그인][오픈아이디란?]
1  ... 192 193 194 195 196 197 198 199 200  ... 775 

달력

«   2008/11   »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30