스타일시트를 분기하는 법 > 자유게시판

자유게시판

스타일시트를 분기하는 법 정보

스타일시트를 분기하는 법

본문

웹폰트(MSIE 에서만 정상 작동)를 쓰고 싶어서.. 그러는 것인데..
파이어폭스 사용자를 위해서

브라우저가 MSIE면, this.css를
아니면, that.css를
가져오도록 하려면
어떤 방법이 제일 무리가 없을까요?

1. 어떤 사이트는 이렇게도 하고..

var cssFile = 'new_gecko.css';
if (navigator.userAgent.toLowerCase().indexOf("msie")  != -1) {
 cssFile = 'new.css';
}

var head = document.getElementsByTagName('head');
var css = head[0].appendChild(document.createElement('link'));
css.setAttribute('type', 'text/css');
css.setAttribute('rel', 'stylesheet');
css.setAttribute('media', 'all');
css.setAttribute('href', '/page/css/'+cssFile);

2. php if로 조건에 따라 서로 다른 css를 인클루드..

추천
0
  • 복사

댓글 4개

스타일시트를 분기(?)하는 일반적인 방법이 있나해서 질문합니다.

제가 "일반적인 방법"을 모르는 문외한이라서..
© SIRSOFT
현재 페이지 제일 처음으로