模板:Box

来自电竞圈
大表哥留言 | 贡献2024年8月22日 (四) 02:32的版本 (创建页面,内容为“<includeonly>{{#switch:{{lc:{{{1|}}}}} |break=</div> <div class{{=}}"template-box" style{{=}}"{{#if:{{{padding|}}}|padding-right:{{{padding}}};}}{{#if:{{{padding-bottom|}}}|padding-bottom:{{{padding-bottom}}};}}{{#if:{{{box-width|}}}|width:{{{box-width}}};}}{{#if:{{{box-height|}}}|height:{{{box-height}}}; overflow:hidden;}}{{{style|}}}"> |end=</div></div> |start |<div {{#if:{{{max-width|}}}|style="{{#if:{{{margin-left|}}}|margin-left:{{{margin-left}}};}}{{#if:{…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到导航 跳转到搜索

Documentation (view - edit)

This template is to be used with fixed width objects to arrange them in a free "floating" fashion where they will take the least amount of vertical space by utilizing as much horizontal space as the individual "boxes" allows. There's also no limit to the amount of boxes you want to make with this, it can be anything from 2 to however many you want. But it does look bad if the objects/boxes are of different height.

Variables

The structure is as follows {{box| first variable | optional variable (padding=,padding-bottom=,margin-left=,margin-right=) }}

  • The first variable has three values you can set it to.
start
Used for the first instance in the array.
break
Used between two boxes.
end
Used to end the array of boxes.
  • padding= / padding-bottom= Set this to any value with either pixels (for example 5px) or em sizes (for example 1em).
  • margin-left= / margin-right= Set this to any value with either pixels (for example 5px) or em sizes (for example 1em).

Example

{{Box|start|padding=1em}}
{| class="wikitable" width="400px"
|<br />
|}
{{Box|break|padding=1em}}
{| class="wikitable" width="400px"
|<br />
|}
{{Box|break}}
{| class="wikitable" width="400px"
|
|}
{{Box|end}}

This code will become these three boxes below, displayed either in a single row a single column or 2 on one row and 1 on the next, depending on your browser window size. Also there's no need to use padding on the last break as nothing can come after it.