웹프로그램밍 자료실/HTML 자료
[해피CGI][cgimall] 코딩시 IE 조건부 주석처리 방법
해피CGI윤실장
2018. 1. 26. 09:00
크로스 브라우징 작업시 IE 버전에 따른 조건부 주석처리를 해야 할 경우가 종종 생깁니다.
그때 유용한 기능으로 아래의 내용을 보고 조건부별로 진행해보세요.
Html
<!--[if condition]> HTML 코드 <![endif]-->조건부
사용되는 기호 :
!: 아니다(not) - 예)[if !ie]ie가 아니라면lt: 작다(less than) - 예)[if lt ie 9]ie9 보다 작다면lte: 작거나 같다(less than equal) - 예)[if lte ie 8]ie8 보다 작거나 같다면gt: 크다(greater than) - 예)[if gt ie 6]ie6 보다 크다면gte: 크거나 같다(greater than equal) - 예)[if gte ie 7]ie7 보다 크거나 같다(): 우선처리&: 그리고(and) - 예)[if (gte ie 7)&(lt ie 9)]ie7 이상이고 ie9 미만이라면|: 또는(or) - 예)[if (ie 7)|(ie 8)]ie7 이거나 ie8 이라면활용<!DOCTYPE html> <!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="ko"> <![endif]--> <!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="ko"> <![endif]--> <!--[if IE 8]> <html class="lt-ie9" lang="ko"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="ko"> <!--<![endif]-->출처 : webdir.tistory.com