跳转到内容
打开/关闭菜单
  • 451 条目
  • 806 文件
  • 22 用户
  • 9167 编辑
Blockland Wiki
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模板:Background:修订间差异

来自Blockland Wiki
创建页面,内容为“<includeonly><div style=" position: fixed; inset: 0; z-index: -1; pointer-events: none; {{#if:{{{image|}}} |background-image: url({{{image}}}); background-size: {{{size|cover}}}; background-position: {{{position|center}}}; background-repeat: {{{repeat|no-repeat}}}; {{#if:{{{color|}}}|background-color: {{{color}}};}} |{{#if:{{{color|}}} |background-color: {{{color}}};…”
 
无编辑摘要
 
(未显示同一用户的23个中间版本)
第1行: 第1行:
<includeonly><div style="
<includeonly><span
     position: fixed;
    class="background-theme"
    inset: 0;
     data-bg-image="{{filepath:{{{背景|}}}|nowiki}}"
    z-index: -1;
    data-bg-opacity="{{{透明度|0.5}}}"
    pointer-events: none;
    data-bg-blur="{{{模糊度|6}}}"
    {{#if:{{{image|}}}
    data-bg-radius="{{{圆角|12}}}"
        |background-image: url({{{image}}});
     data-bg-title="{{{标题颜色|#FFFFFF}}}"
          background-size: {{{size|cover}}};
    aria-hidden="true"
          background-position: {{{position|center}}};
></span></includeonly>
          background-repeat: {{{repeat|no-repeat}}};
          {{#if:{{{color|}}}|background-color: {{{color}}};}}
        |{{#if:{{{color|}}}
            |background-color: {{{color}}};
          }}
    }}
    {{#if:{{{opacity|}}}
        |opacity: {{{opacity}}};
     }}
"></div></includeonly><noinclude>
{{Documentation
|content=
'''Template:Background''' — 为页面设置全屏背景图片或背景色。
 
== 用法 ==
 
=== 背景图片 ===
<pre>{{Background
|image  = https://example.com/bg.jpg
|size    = cover(默认)/contain/100% 100%
|position= center(默认)/top/left 等
|repeat  = no-repeat(默认)/repeat
|opacity = 0.5(可选,0~1)
}}</pre>
 
=== 纯色背景 ===
<pre>{{Background
|color  = #1a1a2e
|opacity = 0.8(可选)
}}</pre>
 
== 参数说明 ==
{| class="wikitable"
! 参数 !! 说明 !! 默认值
|-
| <code>image</code> || 背景图片 URL || —
|-
| <code>color</code> || 背景颜色(十六进制/rgb/关键词) || —
|-
| <code>size</code> || 背景图片尺寸 || cover
|-
| <code>position</code> || 背景图片位置 || center
|-
| <code>repeat</code> || 背景图片重复 || no-repeat
|-
| <code>opacity</code> || 整体透明度(0~1) || 1
|}
 
== 示例 ==
<pre>{{Background
|image = https://example.com/forest.jpg
|color = #0d1117
|opacity = 0.85
}}</pre>
 
== 注意 ==
* 模板使用 <code>position: fixed</code> 固定背景,不随页面滚动。
* <code>pointer-events: none</code> 确保背景不会阻挡页面交互。
* 建议搭配浅色/深色文字使用,确保可读性。
}}
</noinclude>

2026年10月22日 (四) 20:47的最新版本