<styleSheet>要素 |
![]() |
ネームスペース: | http://xmlns.oracle.com/uix/style |
構文 |
![]() |
<styleSheet [ browsers="style:browserListType" ] [ direction="" ] [ locales="style:localeListType" ] [ platforms="style:platformListType" ] [ versions="style:versionListType" ] > <!-- The following child can be anything derived from the given element --> <style></style> </styleSheet>
説明 |
![]() |
<styleSheet>要素は、特定のエンド・ユーザー環境に適用されるスタイルのセットを定義します。1つのXSS文書内で、任意の数の<styleSheet>要素を定義できます。各<styleSheet>要素では、その内部で定義したスタイルが適用されるエンド・ユーザー環境を示す属性のセットを指定します。<styleSheet>要素で属性を指定せずに定義したスタイルは、すべてのエンド・ユーザー環境に適用されます。
例 |
![]() |
スタイルシート文書には、複数のスタイルシートを含めることができ、各スタイルシートは特定のエンド・ユーザー環境用のスタイル・セットを定義します。<styleSheet>要素の属性を使用すると、指定したスタイルが適用されるエンド・ユーザー環境を限定できます。属性を指定しない<styleSheet>要素は、ベースすなわちデフォルトのスタイルシートです。このスタイルシート内で定義されたスタイルは、すべてのエンド・ユーザー環境に適用されます。
次の例では、表の列ヘッダーのスタイルを定義します。この場合、ベース・スタイルシートでは、.OraTableColumnHeaderのデフォルト・プロパティを定義しており、これがすべての環境で使用されます。2番目のスタイルシートはNetscape Navigator用の定義で、.OraTableColumnHeaderに新たにline-heightプロパティを追加しています。このプロパティは、Netscape Navigatorで表の列ヘッダーを正しくレンダリングするために必要です。この場合、ベース・スタイルシートで .OraTableColumnHeaderに定義されたすべてのスタイル・プロパティは、Netscape Navigatorでも有効なので注意してください。新しいスタイルは、これらのデフォルトのスタイル・プロパティに追加されるだけです。
<styleSheetDocument>
<!-- The base style sheet -->
<styleSheet>
<style selector=".OraTableColumnHeader">
<includeStyle name="DefaultBoldFont"/>
<includeStyle name="StartTextAlign"/>
<colorProperty name="background-color">DarkAccent</colorProperty>
<colorProperty name="color">Dark</colorProperty>
<property name="text-indent">1</property>
</style>
<!-- other styles -->
</styleSheet>
<!-- a derived style sheet for Netscape -->
<styleSheet browsers="netscape">
<style selector=".OraTableColumnHeader">
<property name="line-height">1.2</property>
</style>
<!-- other styles -->
</styleSheet>
</styleSheetDocument>
次の例では、ベース・スタイルシートで、左から右に記述する言語環境向きのテキストの配置スタイルを定義しています。派生したスタイルシートでは、右から左に記述する言語環境向きのテキストの配置スタイルを定義します。この派生したスタイルシートでは、上の例のようにスタイルは追加していません。そのかわりに、既存のStartTextAlignスタイルおよびEndTextAlignスタイルのtext-alignプロパティの値が上書きされます。
<styleSheetDocument>
<!-- The base style sheet -->
<styleSheet>
<style name="StartTextAlign">
<property name="text-align">left</property>
</style>
<style name="EndTextAlign">
<property name="text-align">right</property>
</style>
<-- other styles... -->
</styleSheet>
<!-- a derived style sheet for languages that read right to left -->
<styleSheet direction="rtl">
<style name="StartTextAlign">
<property name="text-align">right</property>
</style>
<style name="EndTextAlign">
<property name="text-align">left</property>
</style>
<-- other styles... -->
</styleSheet>
</styleSheetDocument>
上の例では、2つのstyleSheetDocument定義を別個に示しましたが、これらすべてのスタイルシートを1つのスタイルシート文書で定義することができます。(実際、これらは同一のスタイルシート文書であるblaf.xssから抽出したものです。)スタイルシートを1つにまとめることにより、右から左に記述する言語を表示するNetscape Navigator環境用のスタイルを生成できます。
locales、browsers、versionsおよびplatforms属性は、いずれも空白文字で区切られた値のリストをサポートします。たとえば、次のスタイルシートは、中国語、日本語および韓国語に適用されます。
<styleSheet locales="zh ja ko">
次のスタイルシートは、IEブラウザとMozillaブラウザには適用されますが、Netscape Navigator(4.x)ブラウザには適用されません。
<styleSheet browsers="ie mozilla">
属性を組み合せて、適用するエンド・ユーザー環境をさらに細かく制限することもできます。たとえば、次のスタイルシートは、IE 5およびIE 6には適用されますが、IE 4およびその他のブラウザには適用されません。
<styleSheet browsers="ie" versions="5 6">
属性 |
![]() |
子要素 |
![]() |
|
Copyright © 2001, 2004, Oracle.All rights reserved.