Help:Tables/Wikitext

If you want to shape tables with wikitext, you have plenty of options. This one page won't go into them all, but it will show you how wikitext matches up to HTML markup, the difference a CSS class makes, and an example of a simple table that works on both desktop and mobile devices.

Basic table code
Wikitext is, in many ways, just shortcut for HTML. If you're familiar with HTML, you probably already know how to build a wikitext table. Here's a chart that will help you understand the connection between wikitext and HTML:

Fandom's default CSS classes
Deep within Fandom's code lie two classes that you can put at the very start of your table. No matter which wiki you're on, there is always some default formatting for  and. If you use VisualEditor,  will be automatically added so that the basic structure of your table will be:

But there are cases where you might consider using  or no class—instead. Here's what they all look like on a completely un-customized wiki:



If you are styling tables with CSS customization, it is often best to target the  class to style tables already using the class, as this one is the default.


 * Technically, another default table class exists at Fandom, called . However, if unaltered by local CSS declarations, it provides precisely the same styling as  

Basic tables
As explained elsewhere, tables don't always display well on mobile web.

The best approach is to keep things as simple as possible. Look at the following wikitext, and then notice, on your phone, how the table works on that smaller display:

...which gives:

More advanced table coding
Tables can be made significantly more advanced than the example above. If you want to explore other options for wikitext tables, you could start by consulting the MediaWiki help page for tables. But remember that much of what you'll see in places like mediawiki.org or Wikipedia's help page don't really consider the effects of tables in mobile. It's important to always check your work with tables on an actual phone to see how well it displays for the many mobile readers of your wiki.

It is also possible, in some specific use cases where data needs to be calculated, to use templates or even to use Lua-based templates, both to create pre-existing table structures, or to use templates within cells.

Further help and feedback
de:Hilfe:Tabellen/Wikitext es:Ayuda:Wikitexto/Ejemplos de tablas fr:Aide:Tableaux/Wikitexte ja:ヘルプ:テーブル/ウィキテキスト ko:도움말:위키 문법/표 예제 pt:Ajuda:Wikitexto/Exemplos de tabelas ru:Справка:Таблицы/викитекст tr:Yardım:Tablolar/Vikimetin uk:Довідка:Таблиці/вікітекст zh:Help:Wiki文本/表格的例子