11.4 Importing External Style Sheets 导入外部样式表
来源:互联网 发布:java等级考试 编辑:程序博客网 时间:2024/05/20 04:28
11.4 Importing External Style Sheets
NN 4, IE 4
11.4.1 Problem
You want to implement a style sheet strategy across multiple HTML documents in a web site without embedding explicit CSS code in every document.
11.4.2 Solution
Define a style sheet (with one or more rules) as a separate .css file and import it into a document with the <link> tag:
<link rel="stylesheet" type="text/css" href="myStyleSheet.css">
The contents of the style sheet file should consist solely of style sheet rules. Do not include the <style> tags or the usual nested HTML comments in this file.
11.4.3 Discussion
The Solution shows a cross-browser solution that works with all CSS-capable browsers. More current browsers that support the CSS2 specification can use an alternative "at-rule" inside the document's <style> tags. The at-rule version of the Solution is:
<style type="text/css"><!--@import url(myStyleSheet.css)--></style>
You can use the @import rule starting with Internet Explorer 4 and Netscape 6. Some scripters use this import technique intentionally to exclude Navigator 4, which ignores the @import rule. You can combine the @import rule with other page-specific style sheet rules within the same <style> tag set on a page.
The filename extension for an external style sheet file should be .css. The server should also be configured to send the text/css MIME type with the file for Netscape 6 and later to process the file correctly (and to adhere to Internet standards).
11.4.4 See Also
Recipe 11.5 for importing style sheets tailored to a particular browser or operating system; Recipe 11.6 for changing an imported style sheet after the page has loaded; Recipe 14.3 for importing HTML content into a page.
[ Team LiB ]- 11.4 Importing External Style Sheets 导入外部样式表
- Qt Style Sheets Qt样式表概述
- Qt Style Sheets(qt样式表)
- 层叠样式表(Cascading Style Sheets,CSS)简介
- CSS 概述 CSS 指层叠样式表 (Cascading Style Sheets)
- CSS(Cascading Style Sheets)层叠样式表
- CSS层叠样式表(Cascading Style Sheets)
- CSS(层叠样式表)Cascading Style Sheets
- CSS(Cascading Style Sheets)层叠样式表
- CSS Cascade Style Sheets 样式表 层叠/级联
- 二、CSS【Cascading Style Sheets层叠样式表】
- CSS Cascading Style Sheets(层叠样式表单)
- Drupal 添加样式文件 add style sheets
- 详解Qt样式/颜色机制:调色板(QPalette)与样式表(Style Sheets)
- CSS 样式表小结 CSS (Cascading style sheets)学完就可以写样式了
- 详解Qt样式/颜色机制:调色板(QPalette)与样式表(Style Sheets)
- 详解Qt样式/颜色机制:调色板(QPalette)与样式表(Style Sheets)
- CSS层叠样式表 (Cascading Style Sheets)基础,CSS样式三种插入方式优先级比较
- 程序员,应该掌握的英语词汇
- IT人的血泪人生
- Windows Via C/C++ Part Ⅰ Chapter3: 内核对象(1)
- 累
- const
- 11.4 Importing External Style Sheets 导入外部样式表
- gcc -l参数和-L参数
- WideString的问题(BCB, 构造函数, 操作符重载, 调用原理)
- c#中抽象类和接口的相同点跟区别
- How to create a new routine
- Sql Server 2005下的MD5、SHA1算法函数
- Salesforce和CRM
- hibernate中主键与unsaved-value关系(Batch update returned unexpected row count from update)
- POD Types Revisited