切換菜單
切換偏好設定選單
切換個人選單
尚未登入
若您做出任何編輯,會公開您的 IP 位址。

本站正在进行早期测试,目前仍存在许多内容的缺失。

於 2026年2月26日 (四) 16:03 由 Sizau對話 | 貢獻 所作的修訂
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)

Overview

The {{CSS}} template is a helper utility used to load TemplateStyles (CSS) from a specific subpage.

Unlike a direct 模板樣式的src屬性不得為空。 call, this template uses the Variables extension to **deduplicate** style tags. If the same stylesheet is requested multiple times on a single page, it will only be output once, preventing the accumulation of redundant `<link rel="mw-deduplicated-inline-style">` tags in the HTML source.

Usage

Insert this template at the top of a template or module page to load its associated `/styles.css` subpage.

{{CSS|PageName|NamespaceID}}

  • **1** (Optional): The base page name. Defaults to the current page name.
  • **2** (Optional): The Namespace ID. Defaults to 10 (Template).
    • 0: Main/Root
    • 4: Project (Starsand Island Wiki)
    • 10: Template
    • 828: Module

Technical Details

  • **Deduplication Logic**: It defines a variable `ts_loaded_[path]` the first time a style is loaded. Subsequent calls to the same path are ignored.
  • **Dependency**: Requires the Variables extension to be installed on the Wiki.

Examples

Basic Usage

To load styles from the current template's `/styles.css` subpage:

Specific Page

To load styles from a specific template:

  • {{CSS|Infobox Item}}

Specific Namespace

To load styles for a module:

  • {{CSS|Common|828}} (Loads `Module:Common/styles.css`)

TemplateData

Loads TemplateStyles for a given page and namespace with automatic deduplication.

模板參數

此模板以參數行內格式為優先。

參數描述類型狀態
Page Name1

The name of the page containing the /styles.css subpage. Defaults to the current page.

字串建議
Namespace ID2

The ID of the namespace (e.g., 10 for Template, 828 for Module). Defaults to 10.

預設
10
數值非必填