CSS

CSS 브라우저 핵

아거스 2010. 12. 9. 01:41
凍足放尿(동족방뇨)

핵을 사용하는것이 좋은 방법은 아니지만 때론 다른 사람이 작성해 놓은 코드를 이해하거나 브라우저간 어쩔 수 없는 경우(아직은 모르겠지만)를 위해 알아야 하지 않나 싶습니다.
바울 아이리시Poul Irish 가 작성한 내용(IE Comment Hack을 사용하여 바디요소에 버전별 클래스를 부여하는 방법)과 Ajaxian.com의 댓글내용입니다.
/***** Selector Hacks ******/
/* IE 6 and below */
* html #uno  { color: red }
/* IE 7 and below */
*:first-child+html #dos { color: red }
/* IE 7 and modern browsers */
html>body #tres { color: red }
/* All IE versions, including IE8 Standards Mode */
#somediv { color: blue\9 }
/* IE8 Standards-Mode */
#comediv { color /*\**/: blue\9 }
/* Modern browsers (not IE 7) */
html>/**/body #cuatro { color: red }
/* Opera 9.27 and below */
html:first-child #cinco { color: red } 
/* Safari */
html[xmlns*=""] body:last-child #seis { color: red } 
/*safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:nth-of-type(1) #siete { color: red } 
/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:first-of-type #ocho {  color: red } 
/* saf3, chrome1+ */
@media screen and (-webkit-min-device-pixel-ratio:0) {   #diez  { background: #FFDECE; border: 2px solid #ff0000  }}

/***** Attribute Hacks ******/
/* ie6 and below */
#once { _color:blue }
/* ie7 and below */
#doce { *color: blue }/* or #color:blue */


참고