Editing User:Myotis/Sandbox

Jump to: navigation, search

Warning: You are not logged in.

Your IP address will be recorded in this page's edit history.
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.
Latest revision Your text
Line 1: Line 1:
==Collapsible Tables==
 
==Simple example==
 
Tables are simpler to work with, as you merely need to add the '''<tt>collapsible</tt>''' class to the table itself. For the [hide]/[show] link to appear, the table's first row must be a header row, that is, one of the cells in the first row must be declared with an exclamation mark (in wikisyntax). The use of the class <tt>wikitable</tt> in the example below is merely for appearance; it is not needed for <tt>collapsible</tt> to function.
 
 
{| class=wikitable style="width:80%;" align=center
 
!Code entered!!Output produced
 
|-
 
|width=50%|&#32;
 
<nowiki>{| class="wikitable </nowiki>'''collapsible'''"
 
'''!'''<nowiki> Simple collapsible table
 
|-
 
| Lorem ipsum dolor sit amet
 
|}</nowiki>
 
|style="width:50%; text-align:center;"|
 
{| class="wikitable collapsible"
 
! Simple collapsible table
 
|-
 
| Lorem ipsum dolor sit amet
 
|}
 
|}
 
 
Using the syntax above, collapsible tables are often used to always display an introduction to, or summary of, a lengthy discussion or section of content, while hiding the majority of that content from immediate view.  The summary message is put in the header cell, and the content is placed into the body cell.  The content is then easily accessible by clicking the 'show' button.  The collapsible functionality is also available in larger and more complicated tables, as long as there is a header cell in the first row of the table.
 
 
{| class=wikitable style="width:80%;" align=center
 
!Code entered!!Output produced
 
|-
 
|style="width:50%; font-size:90%"|&#32;
 
<nowiki>{| class="wikitable </nowiki>'''collapsible'''<nowiki>"
 
|A normal cell in the header row
 
</nowiki>'''!'''<nowiki> colspan="2"| Header cell spans two cols
 
|-
 
| colspan="2" | Lorem ipsum dolor sit amet
 
| Separate body cell
 
|}</nowiki>
 
|style="width:50%; text-align:center;"|
 
{| class="wikitable collapsible"
 
|width=33%|A normal cell in the header row
 
! colspan="2"| Header cell spans two cols
 
|-
 
| colspan="2" | Lorem ipsum dolor sit amet
 
|width=33%| Separate body cell
 
|}
 
|}
 
 
==Collapsing tables by default==
 
Just using the <tt>'''collapsible'''</tt> class produces a table which is expanded by default, but can be collapsed by the reader.  It is also possible to create tables which are ''collapsed'' by default, and can be optionally ''expanded''.  There are several methods for doing this, depending on the situations in which you want the table to collapse.
 
 
==='collapsed'===
 
Adding the <tt>'''collapsed'''</tt> class will cause the table to ''always'' be initially collapsed, no matter what happens around it.  It is the simplest method for doing so.  Using the examples above:
 
 
{| class=wikitable style="width:80%;" align=center
 
!Code entered!!Output produced
 
|-
 
|width=50%|&#32;
 
<nowiki>{| class="wikitable </nowiki>'''collapsible collapsed'''"
 
'''!'''<nowiki> Simple collapsible table
 
|-
 
| Lorem ipsum dolor sit amet
 
|}</nowiki>
 
|style="width:50%; text-align:center;"|
 
{| class="wikitable collapsible collapsed"
 
! Simple collapsible table
 
|-
 
| Lorem ipsum dolor sit amet
 
|}
 
|-
 
|style="width:50%; font-size:90%"|&#32;
 
<nowiki>{| class="wikitable </nowiki>'''collapsible collapsed'''<nowiki>"
 
|A normal cell in the header row
 
</nowiki>'''!'''<nowiki> colspan="2"| Header cell spans two cols
 
|-
 
| colspan="2" | Lorem ipsum dolor sit amet
 
| Separate body cell
 
|}</nowiki>
 
|style="width:50%; text-align:center;"|
 
{| class="wikitable collapsible collapsed"
 
|width=33%|A normal cell in the header row
 
! colspan="2"| Header cell spans two cols
 
|-
 
| colspan="2" | Lorem ipsum dolor sit amet
 
|width=33%| Separate body cell
 
|}
 
|}
 
 
==='autocollapse'===
 
Adding the <tt>'''autocollapse'''</tt> class causes the table to collapse when there are 2 or more collapsible tables on the page (this threshold might be different on other projects). The example below, therefore, collapses because there are numerous collapsible tables on the page.
 
 
{| class=wikitable style="width:80%;" align=center
 
!Code entered!!Output produced
 
|-
 
|width=50%|&#32;
 
<nowiki>{| class="wikitable </nowiki>'''collapsible autocollapse'''"
 
'''!'''<nowiki> Simple collapsible table
 
|-
 
| Lorem ipsum dolor sit amet
 
|}</nowiki>
 
|style="width:50%; text-align:center;"|
 
{| class="wikitable collapsible autocollapse"
 
! Simple collapsible table
 
|-
 
| Lorem ipsum dolor sit amet
 
|}
 
|}
 
 
==='innercollapse' and 'outercollapse'===
 
Using this pair of classes, it is possible to make a table collapsed by default only when it is ''contained within'' a particular object, such as another table. This is mainly useful for tables inside templates, which are often nested.
 
 
{| class=wikitable style="width:80%;" align=center
 
!Code entered!!Output produced
 
|-
 
|width=50%|&#32;
 
<nowiki>{| class="wikitable </nowiki>'''outercollapse'''<nowiki>"
 
! This table does not collapse
 
|-
 
| But the table inside this cell
 
 
{| class="wikitable </nowiki>'''collapsible innercollapse'''<nowiki>"
 
! Does collapse
 
|-
 
| Hiding this part
 
|}
 
 
|}</nowiki>
 
|style="width:50%; text-align:center;"|
 
{| class="wikitable outercollapse"
 
! This table does not collapse
 
|-
 
| But the table inside this cell
 
{| class="wikitable collapsible innercollapse"
 
! Does collapse
 
|-
 
| Hiding this part
 
|}
 
|}
 
 
|}
 
 
==Other notes==
 
 
===Sortable tables===
 
Collapsible tables can be combined with the [[Help:Sorting|sortable tables]] functionality without difficulty.  However, because the hide/show button is placed in the first header cell located, its positioning can look a bit peculiar if the table is not wide enough:
 
 
{| class=wikitable style="width:80%;" align=center
 
!Code entered!!Output produced
 
|-
 
|width=50%|&#32;
 
<nowiki>{| class="wikitable </nowiki>'''collapsible sortable'''<nowiki>"
 
!Name!!Score
 
|-
 
|John||59
 
|-
 
|Jane||100
 
|-
 
|Bob||72
 
|}</nowiki>
 
|style="width:50%; text-align:center;"|
 
{|class="wikitable sortable collapsible"
 
!Name!!Score
 
|-
 
|John||59
 
|-
 
|Jane||100
 
|-
 
|Bob||72
 
|}
 
|}
 
 
{| class="wikitable collapsible collapsed" style="border:none; width:150px; float:right;"
 
!header
 
|-
 
|style="padding:0; border:none;"|
 
{|class="wikitable sortable" style="margin:0; width:100%;"
 
!a
 
!b
 
|-
 
|3
 
|4
 
|-
 
|5
 
|6
 
|}
 
|}
 
Possible alternative is sortable table inside one-cell collapsible table, see example on the right.
 
 
===Customization===
 
Registered users can edit [[Special:MyPage/skin.js|their personal js file]] file to change some of the variables used.
 
 
<source lang=javascript>
 
autoCollapse = 4 //how many collapsible tables on the page before autocollapse works (default=2)
 
var collapseCaption = 'collapse' //text of the [hide] link (default='hide')
 
var expandCaption = 'uncollapse' //text of the [show] link (default='show')
 
</source>
 
 
 
 
 
 
 
 
 
<div style="clear:both" class="NavFrame">
 
<div style="clear:both" class="NavFrame">
 
<div class="NavHead"><big>Tabelle der 216 Websicheren Farben</big></div>
 
<div class="NavHead"><big>Tabelle der 216 Websicheren Farben</big></div>

All contributions to SpongePedia are considered to be released under the GNU Free Documentation License 1.3 (see SpongePedia:Copyrights for details). Your changes will be visible immediately after you clicked "Save page".
Please enter a summary of your changes below.
If you are unsure about how the text will come out, select the "Show preview" button to see how it turns out.
If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Any vandalism of a page may result in a block.

Do not submit copyrighted images or text without permission!
  • Upload images to SpongePedia.
  • Don't forget to categorize pages!
  • For testing, please use a sandbox.
Cancel | Editing help (opens in new window)
Personal tools
Namespaces

Variants
Actions
Navigation
Community
Content
Toolbox