하나의 CSS 파일을 다른 파일에 포함할 수 있나요?
예:
@import url("base.css");
참고:
][1] 규칙은 다른 모든 규칙(
@charset` 제외)에 2 선행해야 합니다.@import
문은 추가 서버 요청이 필요합니다. 또는 모든 CSS를 하나의 파일로 연결하여 여러 HTTP 요청을 피할 수 있습니다. 예를 들어, base.css
와 special.css
의 내용을 base-special.css
에 복사하고 base-special.css
만 참조합니다.예. Css 파일 압축을 임포트하지 다른 CSS 파일 수 있다.
첫 번째 비활성화해야 의 규칙을 사용하여 스타일 시트를 [@import 규칙] [1].
@import "mystyle.css";
@import url("mystyle.css");
이 것이 유일한 단서 조항 tfsnap 웹 브라우저를 지원하지 않습니다. 사실, CSS & # 39 hack& # 39, 이 중 하나다. css 스타일 숨기기 위해 이전 브라우저.
이 목록 의 브라우저 지원 () 는 다음과 같은 뜻이 있다.
[1]: http://www.w3.org/TR/CSS21/cascade.html # dell. 가져오기의
예.
@import "your.css";
이 규칙은 문서화했습니다 [here] [1].
[1]: http://www.w3.org/TR/CSS2/cascade.html # dell. 가져오기의
이 " @import"; 규칙을 파일을 여러 스타일을 통화할 수 있다. 이러한 파일은 브라우저에서 HTML 태그를 필요할 때 또는 사용자 에이전트 불렀으매 security. CSS. (예:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN" dir="ltr">
<head>
<title>Using @import</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
@import url("main.css");
</style>
</head>
<body>
</body>
</html>
CSS 파일 " main.css"; 다음 구문을 포함되어 있습니다.
@import url("fineprint.css") print;
@import url("bluish.css") projection, tv;
@import 'custom.css';
@import url("chrome://communicator/skin/");
@import "common.css" screen, projection;
@import url('landscape.css') screen and (orientation:landscape);
[# 39, t 크리스테스노드 don& 경로재설정 이너사믈] 사용하여 스타일로 삽입하려면 요소 1 그러나:
<script>
var style = document.createElement('style');
style.setAttribute("type", "text/css");
var textNode = document.createTextNode("
@import 'fineprint.css' print;
@import 'bluish.css' projection, tv;
@import 'custom.css';
@import 'chrome://communicator/skin/';
@import 'common.css' screen, projection;
@import 'landscape.css' screen and (orientation:landscape);
");
style.appendChild(textNode);
</script>
하지만, 어떤 이유로든 @import didn& # 39, t, s not it& # 39 내 업무에 꼭 필요한 셜록이야?
<link rel="stylesheet" media="print" href="myap-print.css">
<link rel="stylesheet" media="print" href="myap-screen.css">
<link rel="stylesheet" media="screen" href="myap-screen.css">
앞서 미디어 = " print"; 2 스타일시트가 있다. myap-print.css 및 myap-screen.css. # 39 의 것과 같은 효과를 내 myap-screen.css myap-print.css. 등 it&.
sing the CSS @import 규칙 [here] (http://www.cssnewbie.com/css-import-rule/ # .Uw1XRPmSzkc sing the CSS @import Rule" ";)
@import url('/css/header.css') screen;
@import url('/css/content.css') screen;
@import url('/css/sidebar.css') screen;
@import url('/css/print.css') print;
내가 이 일을 desktopplatforms DON& T # 39 라고 말해주고 싶어 빛위에 발견했다, CSS 의 사용을 @IMPORT!!!! 클라이언트 및 클라이언트 높여줍니까 가져오기의 기술서임을 송신됩니다 다른 요청. Css 나눌 수 있는 다양한 파일을 스케쳐내 간에 적게 사용합니다. 무슨 일이 있어도 가져오기의 기술서임을 감소 및 서버의 성능 저하 및 출력 캐시됩니다 클라이언트뿐 실행하여 다른 연결 할 수 있도록 만들 수는 없습니다. 그는 여기에있다 나는 또 다른 옵션을 자스 모를 일이다. 솔직히, 사용하지 않을 경우, Less, 자스 어졌다면 시작해야 합니다. http://willseitz-code.blogspot.com/2013/01/using-less-to-manage-css-files.html