Editing Template:Box
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page is not enabled for semantic in-text annotations due to namespace restrictions. Details about how to enable the namespace can be found on the configuration help page.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
<includeonly>{{#switch:{{lc:{{{1|}}}}} | <includeonly>{{#switch:{{lc:{{{1|}}}}} | ||
|break=</div> | |break=</div> | ||
− | <div style{{=}}"display:inline-block; vertical-align: top; margin: | + | <div style{{=}}"display:inline-block; vertical-align: top; margin: 0 0 0 0;{{#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="max-width:{{{max-width}}};"}}><div style{{=}}"display:inline-block; vertical-align: top; margin: 0 0 0 0;{{#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|}}}"> | |
− | - | + | }}</includeonly><noinclude> |
+ | 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 utalizing 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 '''<nowiki>{{box|</nowiki> '''''first variable''' | '''optional variable ('''padding=''') '''''<nowiki>}}</nowiki>''' | ||
+ | *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=''' Defines the distance to neighbour elements towards the right. Set this to any value with either pixels (for example 5px) or em sizes (for example 1em). | ||
+ | *'''padding-bottom=''' Defines the distance to neighbour elements towards the bottom. Set this to any value with either pixels (for example 5px) or em sizes (for example 1em). | ||
+ | *'''box-width=''' Defines the width of the following box. Set this to any value with either pixels (for example 5px) or em sizes (for example 1em). | ||
+ | *'''box-height=''' Defines the height of the following box. Set this to any value with either pixels (for example 5px) or em sizes (for example 1em). | ||
+ | |||
+ | ==Example== | ||
+ | |||
+ | <pre> | ||
+ | <nowiki>{{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}}</nowiki></pre> | ||
+ | |||
+ | 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. | ||
+ | {{Box|start|padding=1em}} | ||
+ | {| class="wikitable" width="400px" | ||
+ | |<br /> | ||
+ | |} | ||
+ | {{Box|break|padding=1em}} | ||
+ | {| class="wikitable" width="400px" | ||
+ | |<br /> | ||
+ | |} | ||
+ | {{Box|break}} | ||
+ | {| class="wikitable" width="400px" | ||
+ | |<br /> | ||
+ | |} | ||
+ | {{Box|end}} | ||
+ | [[Category:Template Documentation Pages]]</noinclude> |