مستخدم:أحمد ش الشيخ~arwiki/مسودة

من ويكيبيديا، الموسوعة الحرة
اذهب إلى: تصفح، ‏ ابحث

كلمة \رابط غير مدعوم\ هي ستكون الكلمة التي تستخدم في عند وجود روابط لا تصلح لوضعها في المسودة

الجداول في ويكيبيديا تستخدم لترتيب عناصر في صفوف وأعمدة. الجداول مفيدة في أشياء كثيرة. وهناك الكثير من الحيل التي تستخدم لجعلها ملائمة لأغراض كثيرة. في هذه الصفحة يوجد الصيغة الأساسية للجدوال وبعض الحيل والنصائح.

استخدام شريط الأدوات[عدل]

شريط الأدوات لفتكور - افتراضي
شريط الأدوات لمونوبوك

لإضافة جدول بشكل تلقائي، انقر Vector toolbar insert table button.png أو Button insert table.png (إضافة جدول) في شريط ادوات التعديل. إذا كان "إضف جدولا" ليس مضمنًا في شريط الأدوات، اتبع هذه التعليمات لإضافته.

النص التالي أضيف بواسطة زر "أضف جدولا"

{| class="wikitable"
|-
! نص الترويسة !! نص الترويسة !! نص الترويسة
|-
| مثال || مثال || مثال
|-
| مثال || مثال || مثال
|-
| مثال || مثال || مثال
|}
نص الترويسة نص الترويسة نص الترويسة
مثال مثال مثال
مثال مثال مثال
مثال مثال مثال

تعليمات صيغة الخط العمودي[عدل]

رأس العمود 1 رأس العمود 2 رأس العمود 3
رأس الصف 1 الخلية 2 الخلية 3
رأس الصف أ الخلية ب الخلية ج

مع أن صيغة HTML للجداول تعمل أيضا، إلا أن نص الويكي الخاص يمكن أن تختصر الجدول. الخط العمودي (pipe) يعمل تماما كما في صيغة جدول HTML، إذن معرفة صيغة جداول HTML ستساعد كثيرا في فهم نصوص الخط العمودي. الاختصارات هي كالتالي:

  • الجدول بكامله محاط بأقواس كبيرة (هذه {} ) بالإضافة إلى خطوط عمودية ( هذه | ). إذن استخدام النص {| هو لبداية الجدول، و |} هو للإنتهاء منه. كل واحدة تحتاج أن تكون في سطر بمفردها:
{|
  نص الجدول هنا
|}
  • وأيضا "عنوان الجدول" يمكن إضافته اختيارياً. يكتب سطر يبدأ مع خط عمودي و علامة الجمع "|+" ثم العنوان بعد ذلك :
{|
|+ العنوان
  الجدول هنا
|}
  • للبدأ "بصف جديد"، يكتب الخط العمودي ثم علامة الشرطة (hyphen) في سطرها الخاص :

"|-". هذا النص للخلايا التي في هذا السطر ستبدأ في السطر التالي.

{|
|+ هذا عنوان الجدول
|-
  نص الصف سيكون هنا
|-
  نص الصف يكون هنا
|}
  • كتابة نصوص لكل خلية في الصف التالي تبدأ بخط عمودي :
{|
|+ عنوان الجدول
|-
| نصوص الخلية تكون هنا
|-
| الخلايا في الصف التالي تكون هنا
| المزيد من الخلايا في نفس الصف هنا
|}
  • الخليا يمكن أن تقسم بسطر جديد و سطر عمودي أو باستخدام خط عمودي مزدوج "||" في نفس السطر، كلاهما سيولدان نفس النتيجة :
{|
|+ عنوان الجدول
|-
|الخلية 1 || الخلية 2 || الخلية 3
|-
|الخلية أ
|الخلية ب
|الخلية ج
|}
  • إذا استخدمت خطوط عمودية أحادية، في الواقع تكون الخلية الأولى "معدّل الصيغة" ، وباقي الخلايا تدمج إلى خلية واحدة:
{| border="1"
|-
|معدّل الصيغة (غير ظاهر) |كل هذه   |(بالإضافة إلى الخطوط العمودية) |تكون هي   |الخلية الأولى
|}

الذي غالبًا سيظهر :

كل هذه |(بالإضافة إلى الخطوط العمودية)|تكون هي |الخلية الأولى

على كل حال، معدّل الصيغة هو مفيد فعلا:

{| border="1"
|-
| الخلية 1 (غير معدل - بدون محاذاة)
|-
| align="left" | الخلية 2 (محاذاة لليسار)
|}
الخلية 1 (غير معدل - بدون محاذاة)
الخلية 2 (محاذاة لليسار)

فقط تذكر، لا أكثر من خطين عموديين أحاديين في السطر الواحد

  • صف رؤوس الأعمدة يعرف باستخدام "! scope="col" |" بدلا من "|" ، واستخدام "!! scope="col" |" بدلا من "||". الخلايا التي تكون رؤوس الأعمدة عادة تظهر بشكل مختلف عن باقي الخلايا، اعتمادًا على نوع متصفحك، ولكنها عادة تكون بخط عريض(ثخين) وتكون محاذية للوسط:
{|
|+ عنوان الجدول
! scope="col" | Column رأس 1 1 
! scope="col" | رأس عمود 2 
! scope="col" | رأس عمود 3
|-
| خلية 1 || خلية 2 || خلية 3
|-
| خلية أ
| خلية ب
| خلية ج
|}
الخلية الأولى في الصف تعرف بأنها رأس صف ببدء السطر بالنص  "! scope="row" |" بدلا من "|"، وبدء النصوص التالية في سطر جديد.
{|
|+ عنوان الجدول
! scope="col" | رأس العمود 1 
! scope="col" | رأس العمود 2 
! scope="col" | رأس العمود 3
|-
! scope="row" | رأس الصف 1
| خلية 2 || خلية 3
|-
! scope="row" | رأس الصف أ
| الخلية أ
| الخلية ب
|}
  • أيضا يمكن استخدام خيارات(parameters) يمكنها تغيير سلوك الخلايا أو الصفوف أو كامل الجدول. على سبيل المثال، يمكن أن يضاف حد للجدول:
{| border="1"
|+ عنوان الجدول
! scope="col" | رأس العمود 1 
! scope="col" | رأس العمود 2 
! scope="col" | رأس العمود 3
|-
! scope="row" | رأس الصف 1
| الخلية 2 || الخلية 3
|-
! scope="row" | رأس الصف  أ
| الخلية ب
| الخلية ج
|}

النتيجة النهائية سوف تظهر هكذا:

عنوان الجدول
رأس العمود 1 رأس العمود 2 رأس العمود 3
رأس الصف 1 الخلية 2 الخلية 3
رأس الصف أ الخلية ب الخلية ج

الخيارات(parameters) التي تسخدم للجدول والتي تستخدم للخلايا هي عينها المستخدمة في HTML ، انظر http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE و جدول (HTML). على كل حال colgroup و col هي غير مدعومة في ميدياويكي .Theadو tbody و tfoot هي مدعومة في ميدياويكي في الاصدار 1.18 (الاصدار الحالي في ويكيبيديا : 1.31.0-wmf.12 (5056cef)).

يكون الجدول مفيدا حتى ولم يكن لأي خلية محتوى. على سبيل المثال، يمكن تعديل ألوان خلفيات الخلايا بواسطة الخيارات(parameters) المستخدمة للخلايا، أو جعل الجدول في رسم بياني، مثل meta:Template talk:Square 8x8 pentomino example. فبذلك يكون تعديلها أسهل بكثير من رفع صورة.

كل صف يجب أن يحتوى على نفس عدد الخلايا في الصفوف الأخرى، إذن عدد الأعمدة في الجدول تكون ثابتة. للخلايا الفارغة، استخدمnon-breaking space كهذه &nbsp; كمحتوى للتأكد من أنها ستعرض. لعرض الخط العمودي(pipe) في خلية، استخدم <nowiki>|</nowiki> أو &#124;.

يمكن استخدام خاصيتي colspan و rowspan لجعل خلية تتوسع لعدد من الأعمدة أو الصفوف، انظر إلى مثال مختلط\رابط غير مدعوم\ في الأسفل. على كل حال، هذه الطريقة لها سلبية وهي أن الترتيب لا يعمل فيها بأي شكل.

أمثلة[عدل]

أمثلة بسيطة[عدل]

كلا النصين التاليين يولدان نفس النتيجة. اختر الأسلوب المبني على رقم الخلايا في كل صف والنص الكامل في داخل كل خلية.

نص صيغة ويكي :

{|
| أ
| ب
|-
| ج
| د
|}
{|
| أ || ب
|-
| ج || د
|}

وتظهر في المتصفح كالتالي (ملاحظة: بدون الحد الظاهر الآن):

أ ب
ج د

جدول الضرب[عدل]

هذه صيغة ويكي :

{| class="wikitable" style="text-align: center; width: 200px; height: 200px;"
|+ جدول الضرب
|-
! scope="col" | × 
! scope="col" | 1 
! scope="col" | 2 
! scope="col" | 3
|-
! scope="row" | 1
| 1 || 2 || 3
|-
! scope="row" | 2
| 2 || 4 || 6
|-
! scope="row" | 3
| 3 || 6 || 9
|-
! scope="row" | 4
| 4 || 8 || 12
|-
! scope="row" | 5
| 5 || 10 || 15
|}

تظهر في المتصفح كالتالي (انظر مساعدة:طراز المستخدم [الإنجليزية]):

Multiplication table
× 1 2 3
1 1 2 3
2 2 4 6
3 3 6 9
4 4 8 12
5 5 10 15

الألوان باستخدام الخيارات(Parameters)[عدل]

يمكن استخدام طريقتين لتحديد ألوان النص و الخلفية لخلية واحدة، الطريقة الأولى هي المفضلة لأن الثانية تستخدم HTML.

نص صيغة ويكي:

{|
| style="background: red; color: white" | ابجد
| هوز
| bgcolor="red" | <font color="white"> حطي </font>
| كلمن
|}

وتعرض في المتصفح كالتالي:

ابجد هوز حطي كلمن

كالخيارات الأخرى، الألوان يمكن أيضا أن تحدد لكامل الصف أو حتى لكامل الجدول؛ خيارات الصف تتجاوز تلك التي للجدول، وخيارات الخلايا تتجاوز التي للجدول. (ملاحظة ليس هناك طريقة سهلة لتحديد اللون لكل عمود، ولكن يمكن استخدام بعض الأدوات لجعل العمل أسهل):

نص صيغة ويكي :

{| style="background: yellow; color: green"
|-
| أبجد || هوز || حطي
|- style="background: red; color: white"
| كلمن || سعفص || قرشت
|-
| ثخذ || style="background: silver" | ضظغلا || أبجد
|}

وتظهر للمتصفح كالتالي:

أبجد هوز حطي
كلمن سعفص قرشت
ثخذ ضظغلا أبجد

لجعل الجدول يندمج مع الخلفية، يمكن استخدام style="background: none;" أو style="background: transparent;". (تحذير: style="background: inherit;"، لا تعمل مع بعض المتصفح، بما فيها IE6!)

لإجبار خلية للمطابقة واحد من الألوان الافتراضية في جداول class="wikitable" قالب استخدم style="background: #f2f2f2" لجعل لون الرؤوس أغمق، وstyle="background: #f9f9f9" لجعل لون باقي الخلايا أفتح.

انظر: طراز،خلفية،قائمة الألوان،ألوان الويب


الطول، والعرض[عدل]

إن طول كامل الجدول وعرضه يمكن أن يكون محدد، كما يمكن أيضا تحديد ارتفاع الصف. لتحديد عرض العمود الأول يمكن تحديد عرض الخلية فيه. إذا كان العرض غير محدد لجميع الأعمدة و/أو الأرتفاع غير محدد لجميع الصفوف، فإن هناك بعض الغموض، والنتيجة تعتمد هنا على المتصفح وقد تتغير من مستخدم لآخر.

نص صيغة ويكي :

{| style="width: 75%; height: 200px" border="1"
|-
| أبجد || هوز || حطي
|- style="height: 100px;"
| كلمن || style="width: 200px;" | سعفص || قرشت
|-
| ثخذ || ضظغلا || أبجد
|}

وتظهر في المتصفح هكذا:

أبجد هوز حطي
كلمن سعفص قرشت
ثخذ ضظغلا أبجد

ملاحظة: style="inline CSS" قد لا تؤثر في بعض المتصفحات. إذا كان التكامل مع المتصفحات مهم، استعمل الطريقة القديمة، مثل width="75%" هذا سيعمل على متصفحات أكثر.

تعيين عرض الأعمدة[عدل]

لإجبار العمود على عرض معين بدلا من استخدام أعرض نص في خلية في العمود، اتبع هذا المثال.

نص صيغة ويكي :

{| border="1" cellpadding="2"
! scope="col" width="50" | الاسم
! scope="col" width="225" | موقع
! scope="col" width="225" | الاصدار
|-
| اللعبة الأولى || موقع ألعاب 1 || الاصدار الثالث
|-
| اللعبة الثانية || موقع ألعاب 2 || الاصدار الخامس
|}
الاسم موقع الاصدار
اللعبة الأولى موقع ألعاب 1 الاصدار الثالث
اللعبة الثانية موقع ألعاب 2 الاصدار الخامس

لتعيين عرض عمود في جدول بدون الرؤوس، حدد عرض أول خلية لكل عمود، كالمثال التالي:

{| border="1" cellpadding="2"
|-
| width="100pt" | عرض هذا العمود 100 نقطة
| width="200pt" | عرض هذا العمود 200 نقطة
| width="300pt" | عرض هذا العمود 300 نقطة
|-
| إلخ || إلخ || إلخ
|}
عرض هذا العمود 100 نقطة عرض هذا العمود 200 نقطة عرض هذا العمود 300 نقطة
إلخ إلخ إلخ

إحدى تطبيقات العروض هي محاذات الأعمدة في الجداول المتتالية:

الدولة مدينة ساحلية
السعودية جدة
الدولة العاصمة
مصر القاهرة
Nowrap[عدل]

In a table that spans the entire width of a page, cells narrower than the widest cell tend to wrap. To keep an entire column from wrapping, use style=white-space:nowrap in a non-header cell on the longest/widest cell to affect the entire column.

Before:

Episode Date Summary
"The Journey Begins" January 1, 2010 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
"When Episodes Attack" January 8, 2010 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
"So Long" January 15, 2010 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

After:

Episode Date Summary
"The Journey Begins" January 1, 2010 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
"When Episodes Attack" January 8, 2010 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
"So Long" January 15, 2010 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Setting borders[عدل]

Table borders default to a complex shaded double-line (the default in HTML); however, those borders can be set to a thin solid line by using a style-parameter (style="border: 1px solid darkgray"), as in the following (Note: if you intend to use the 'cellpadding' or 'cellspacing' options along with a border, you MUST use this format):

{| cellpadding="2" style="border: 1px solid darkgray;"
! width="140" | Left
! width="150" | Middle
! width="130" | Right
|- border="0"
| [[File:StarIconBronze.png|120px]]
| [[File:StarIconGold.png|120px|Caption when mouse-over image]]
| [[File:StarIconGreen.png|120px|Green stellar icon]]
|- align="center"
| Bronze star || Gold star || Green star
|}

Note the bottom-row texts are centered by 'align="center"' while star-images were not centered.

Left Middle Right
StarIconBronze.png Caption when mouse-over image Green stellar icon
Bronze star Gold star Green star

As long as the "Image:" specs omit the parameter "thumb|" they will not show the caption lines in the table (only during mouse-over). The border color "darkgray" matches typical tables or infoboxes in articles; however, it could be any color name (such as style="border: 1px solid darkgreen;") or use a hex-color (such as: #DDCCBB).

A column format-specifier (enclosed in "|...|") can have a style-parameter to set borders on each cell, as follows:

{| cellpadding="2" style="border: 1px solid darkgray;"
! width="140" | Left
! width="150" | Middle
! width="130" | Right
|- align="center"
| style="border: 1px solid blue;"|
[[File:StarIconBronze.png|120px]]
| style="border: 1px solid #777777;"|
[[File:StarIconGold.png|120px|Caption when mouse-over image]]
| style="border: 1px solid #22AA55;"|<!--greenish border-->
[[File:StarIconGreen.png|120px|Green stellar icon]]
|- align="center"
|Bronze star || Gold star || Green star
|}

Note only the image cells, here, have individual borders, not the text.

Left Middle Right

StarIconBronze.png

Caption when mouse-over image

Green stellar icon

Bronze star Gold star Green star

The lower hex-colors (such as: #616161) are closer to black. Typically, all borders in a table would be one specific color.

Vertical alignment[عدل]

By default data in tables is vertically centrally aligned, which results in odd-looking layouts like this:

Row heading A longer piece of text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. short text
Row heading Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Imagine someone scrolling down the page, seeing the tops of "empty" columns, and wondering why they're empty. Use "valign=top" to align text at the top of columns.
short text

To fix this, apply the valign="top" attribute to the rows (unfortunately it seems to be necessary to apply this individually to every single row). For example:

{| border="1" cellpadding="2" width="400"
|- valign="top"
! scope="row" width="10%" | Row heading
| width="70%" | A longer piece of text. Lorem ipsum...
| width="20%" | short text
|- valign="top"
! scope="row" | Row heading
| Excepteur sint occaecat...
| short text
|}
Row heading A longer piece of text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. short text
Row heading Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Imagine someone scrolling down the page, seeing the tops of "empty" columns, and wondering why they're empty. Use "valign=top" to align text at the top of columns.
short text

Positioning[عدل]

You can position the table itself, the contents of a row, and the contents of a cell, but not with a single parameter for all the contents of the table. See m:Template talk:Table demo.

Prior to April 2009, using "float" to position a table was discouraged; however, it no longer always breaks page rendering at large font sizes. See a floated image, below, under "Floating images in the center".

Mélange[عدل]

Note: This example is not accessible, and should be avoided as much as possible. For example, nested tables (tables inside tables) should be separated into distinct tables when possible.

Here's a more advanced example, showing some more options available for making up tables. Note however that with colspan and rowspan sorting does not work properly anymore.

You can play with these settings in your own table to see what effect they have. Not all of these techniques may be appropriate in all cases; just because you can add colored backgrounds, for example, doesn't mean it's always a good idea. Try to keep the markup in your tables relatively simple -- remember, other people are going to be editing the article too! This example should give you an idea of what is possible, though.

The wiki markup code:

{| border="1" cellpadding="5" cellspacing="0" align="center"
|+ '''An example table'''
|-
! style="background: #efefef;" | First header
! colspan="2" style="background: #ffdead;" | Second header
|-
| upper left
| &nbsp;
| rowspan="2" style="border-bottom: 3px solid grey;" valign="top" |
right side
|-
| style="border-bottom: 3px solid grey;" | lower left
| style="border-bottom: 3px solid grey;" | lower middle
|-
| colspan="3" align="center" |
{| border="0"
|+ ''A table in a table''
|-
| align="center" width="150" | [[File:Wiki.png]]
| align="center" width="150" | [[File:Wiki.png]]
|-
| align="center" colspan="2" style="border-top: 1px solid red;<!--
  --> border-right: 1px solid red; border-bottom: 2px solid red;<!--
  --> border-left: 1px solid red;" |
Two Wikipedia logos
|}
|}

As it appears in a browser:

An example table
First header Second header
upper left  

right side

lower left lower middle
A table in a table
ملف:Wiki.png ملف:Wiki.png

Two Wikipedia logos

Floating table[عدل]

The wiki markup coding:

This paragraph is before the table.  Lorem ipsum dolor sit
amet, consectetur adipisicing elit, sed do eiusmod...

{| style="float: right;" border="1"
| Col 1, row 1
| rowspan="2" | Col 2, row 1 (and 2)
| Col 3, row 1
|-
| Col 1, row 2
| Col 3, row 2
|}

Note the floating-table to the right.

This paragraph is after the table.  The text in column 2
will span both rows due to format specifier "rowspan=2" so there
is no coding for "Col 2" in the 2nd row, just: Col 1 & Col 3.

As it appears in a browser:

This paragraph is before the table. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod...

Col 1, row 1 Col 2, row 1 (and 2) Col 3, row 1
Col 1, row 2 Col 3, row 2

Note the floating-table to the right.

This paragraph is after the table. The text in column 2 will span both rows due to format specifier "rowspan=2" so there is no coding for "Col 2" in the 2nd row, just: Col 1 & Col 3.

Floating images in the center[عدل]

A table can be used to wrap an image, so that the table can float towards the center of the page (such as using: style="float: right;"). However, the table margins, border and font-size must be precisely set to match a typical image display. The Image-spec parameter "thumb|" (although auto-thumbnailing to user-preference width) forces a wide left-margin that squeezes the nearby text, so the parameter "center|" can be added to suppress the left-margin padding. However, "center" sometimes shoves the caption to a 2nd line (under a centered box "[]"), so "thumb|" could be omitted and just hard-code the image size, adding a gray (#BBB) border. Using precise parameters to match other images, a floating-image table can be coded as follows:

{| style="float: right; border: 1px solid #BBB; margin: .46em 0 0 .2em;"
|- style="font-size: 86%;"
| valign="top" |[[File:DuraEuropos-TempleOfBel.jpg|180px]]<!--
  --><br /> Temple of [[Bel (mythology)|Bel]] (floating).
|}

The text inside the floating-table is sized by style="font-size: 86%;". That floating-image table floats a typical image-box, but allows adjusting the left-hand margin of the image (see temple-example floating below).

Infobox A
This sample infobox shows how the floating image-box aligns toward the center.
DuraEuropos-TempleOfBel.jpg
 Temple of Bel  (floating).
This table shows the implicit margins of Images using "right".

The caption-text can be omitted, or remove the parameter "thumb|" so the caption is hidden until "mouse-over display". Unfortunately the parameter "thumb|" (used for displaying the caption) also controls the auto-thumbnailing to re-size images by user-preferences size. In April 2009, it was not possible to have auto-thumbnail sizing while also concealing the caption: parameter "thumb|" triggers both actions and forces the caption to display.

An image set with parameter "left|" will gain a wide right-side margin (opposite margin of parameter "right|"), so floating toward the left would require an image set as "center|" inside a table with style="float:left; margin:0.46em 0.2em".

Recall that, outside an image-table, the parameter "right|" causes an image to align (either) above or below an infobox, but would not float alongside the infobox.

Note the order of precedence: first come infoboxes or images using "right|", then come the floating-tables, and lastly, any text will wrap that can still fit. If the first text-word is too long, no text will fit to complete the left-hand side, so beware creating a "ragged left margin" when not enough space remains for text to fit alongside floating-tables.

If multiple single image-tables are stacked, they will float to align across the page, depending on page-width. The text will be squeezed to allow as many floating-tables as can fit, as auto-aligned, then wrap whatever text (can still fit) at the left-hand side.

DuraEuropos-TempleOfBel.jpg
...by float: right
DuraEuropos-TempleOfBel.jpg
...images wrap...
DuraEuropos-TempleOfBel.jpg
All these...

That auto-aligning feature can be used to create a "floating-gallery" of images: a set of 20 floating-tables will wrap (backward, right-to-left) as if each table were a word of text to wrap across and down the page. To wrap in the typical direction (wrapping left-to-right) define all those floating-tables, instead, as left-side tables using the top parameter style="float:left; margin:0.46em 0.2em". Multiple floating-images empower more flexible typesetting of images around the text.

Nested tables[عدل]

Note: because they cause accessibility issues, nested tables should be avoided whenever possible.

Seven different (blue) tables are shown nested inside the cells of a table. Automatically the two tables |A| and |B|B| are vertically aligned instead of the usual side by side of text characters in a cell. "float" is used to fix each of tables |C| and |D| to their own position within one cell of the table. This may be used for charts and schemes. Nested tables must start on a new line.

Wiki markup

{| border="1"
| &alpha;
| style="text-align: center;"| cell2
{| border="2" style="background: #ABCDEF;" <!-- The nested table must be on a new line -->
| NESTED
|-
| TABLE
|}
| style="vertical-align:bottom;"| the original table again
| style="width:100px;" |
{| border="2" style="background: #ABCDEF;"
| A
|}
{| border="2" style="background: #ABCDEF;"
| B || B
|}
| style="width:50px;" |
{| border="2" style="background: #ABCDEF; float:left;"
| C
|}
{| border="2" style="background: #ABCDEF; float: right;"
| D
|}
|}

As it appears in a browser:

α cell2
NESTED
TABLE
the original table again
A
B B
C
D

Combined use of COLSPAN and ROWSPAN[عدل]

Wiki markup

{| border="1" cellpadding="5" cellspacing="0"
|-
| Column 1 || Column 2 || Column 3
|-
| rowspan="2" | A
| colspan="2" style="text-align: center;" | B
|-
| C <!-- column 1 occupied by cell A -->
| D
|-
| E
| rowspan="2" colspan="2" style="text-align: center;" | F
|-
| G <!-- column 2+3 occupied by cell F -->
|-
| colspan="3" style="text-align: center;" | H
|}

As it appears in a browser:

Column 1 Column 2 Column 3
A B
C D
E F
G
H

Note that using rowspan="2" for cell G combined with rowspan="3" for cell F to get another row below G and F won't work, because all (implicit) cells would be empty. Likewise complete columns are not displayed if all their cells are empty. Borders between non-empty and empty cells might be also not displayed (depending on the browser), use &nbsp; to fill an empty cell with dummy content.

Centering tables[عدل]

Centered tables can be achieved, but they will not "float"; that is to say, no text will appear to either side. The trick is {| style="margin: 1em auto 1em auto;"

Wiki markup

{| class="wikitable" style="margin: 1em auto 1em auto;"
|+ '''Cells left-aligned, table centered'''
! scope="col" | Duis 
! scope="col" | aute 
! scope="col" | irure
|-
| dolor  || in reprehenderit || in voluptate velit
|-
| esse cillum dolore || eu fugiat nulla || pariatur.
|}

As it appears in a browser:

Cells left-aligned, table centered
Duis aute irure
dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur.

Setting parameters[عدل]

At the start of a cell, add your parameter followed by a single pipe. For example width="300"| will set that cell to a width of 300 pixels. To set more than one parameter, leave a space between each one, as follows:

{| style="color:white"
|-
| bgcolor="red"|cell1 || width="300" bgcolor="blue"|cell2
| bgcolor="green"|cell3
|}

As it appears in a browser:

cell1 cell2 cell3

Tiny tables within a text line[عدل]

For years in لغة ترميز النص الفائق, a table has always forced an implicit line-wrap (or line-break), so to keep a table within a line, the work-around is to put all text into a table, then embed a table-within-a-table, using the outer table to force the whole line to stay together. Consider the following examples:

Wikicode (showing table forces line-break):
* This is a test table here <table style="border: 1px solid black"><tr><td>HELLO WORLD</table> followed by this text afterward.
Result:
  • This is a test table here
    HELLO WORLD
    followed by this text afterward.
Wikicode (table-within-table):
* <table style="background-color: #fafeff"><tr><td>This is a test table here<td><table height=11px><tr><td style="border: 1px solid black; font-size:60%">HELLO WORLD</table></td><td>followed by this text afterward.</table> This line is more text after the outer table.
Result:
  • This is a test table here
    HELLO WORLD
    followed by this text afterward.
    This line is more text after the outer table.

Use style="font-size:60%" to shrink the text within the box. However, the small text could be replaced with small images (aligned inside the inner table). The outer table is for one line only, so to make a 2nd line appear even, the exact length of line 1 must be pre-determined, to match the length of other lines.

Decimal point alignment[عدل]

A method to get columns of numbers aligned at the decimal point is as follows:

{| cellpadding="0" cellspacing="0"
| align="right" | 432 || .1
|-
| align="right" | 43 || .21
|-
| align="right" | 4 || .321
|}

As it appears in a browser:

432 .1
43 .21
4 .321

If the column of numbers appears in a table with cell padding or cell spacing, you can still align the decimal points without an unsightly gap in the middle. Embed a table in each number's cell and specify its column widths. Make the embedded tables' column widths the same for each cell in the column. (If decimal points are still misaligned using this method, the main table's column may be too narrow. Add a parameter to increase the column's width.) The wiki markup code:

{| border="1" cellpadding="4" cellspacing="2"
|
{| cellpadding="0" cellspacing="0" width="100"
| align="right" width="50%"| 432 || width="50%" | .1
|}
|-
|
{| cellpadding="0" cellspacing="0" width="100"
| align="right" width="50%"| 43 || width="50%" | .21
|}
|-
|
{| cellpadding="0" cellspacing="0" width="100"
| align="right" width="50%" | 4 || width="50%" | .321
|}
|}

As it appears in a browser:

432 .1
43 .21
4 .321

In the case of preformatted text, you can dispense with the table feature entirely and simply start the lines with a space, and put spaces to position the numbers:

432.1
 43.21
  4.321

However, there should be a good reason to use pre-formatted text in an article.

Cladograms[عدل]

There's full documentation at {{Clade}} and {{Cladex}}.

If you write this

{{cot|Example showing various things to avoid|expand=true}}
{{clade| style=font-size:90%;line-height:85%
|label1=Example_label_One, can't_have_spaces except nbsp_types
|1=Example text One can have spaces
|5=Example text 5 can be placed out of order making it harder to edit later, please don't do this.
|label2=example_subclade
|2={{clade
   |label1=example label with spaces
   |1=subitem1 for this clade
   |2=subitem2 
   |3=subitem3
   }} 
|label3=example_subclade_2
|3={{clade
   |label1=subitem1_missing_but_with_label
   |2=subitem2
   |label3=subitem3_is_a_subclade_of_subclade2
   |3={{clade
      |1=subitemA
      |2=subitemB
      |label3=you_don't_have_to_give_every_item_a_number but_you_can't_control_labels_easily 
      |3={{clade
         |1=subitem1 can't be seen
         |2=subitem2 can't be seen 
         |label2=this_should_label_subitem2 (which doesn't show up) so it drops onto X
         |label9=this_should_label_the_box (caused_by_a_space_before_the_data)
         |Z|X|A|B|C|D|E|FGHIJK| FGHIJK|L|abcdefg
         <!-- the next three sets of curly brackets 'close' 3 clades-->
         <!--to make it easy to edit later the opening pair of curly brackets -->
         <!--are directly above the closing pair-->
         <!--and everything in those clade is indented so it's obvious what belongs where-->
         }} 
      }} 
   }} 
|label4= mostly sensible clade
|4={{clade
   |1=subitem1
   |2=subitem2
   |3=subitem3
   |4={{clade
      |label1=Gold star on blue
      |1=[[File:Gold star on blue.gif|199x95px]]
      |label2=an exploding [[Star]] is a 
      |2=[[Supernova]]
      |label3=[[File:Gold star on blue.gif|199x95px]]images in labels move the line too far down.
      |3={{clade
         |1=subitem1
         |2=subitem2
         |3=subitem3
         }}
      }} 
   }} |label5=label for example text 5
|6= this is example text 6 - placed where Example text 5 should have gone in the edit tab
|label7=first label ignored
|label7=second label overwrites first
|7= Example item with no subclade but with two labels (that won't work)
|label8=example next set of subclades
|8={{clade
   |1=subitem1
   |2=subitem2
   |3=subitem3
|label4=this label without nbsp type spaces pushes the line too far down 
<!--and it no longer lines up with the subclade it was pointing to-->
   |4={{clade
      |1=subitem1
      |2=subitem2
      |3=subitem3
      }} 
   }} 
}}
{{cob}}

it looks like this

Example showing various things to avoid
Example_label_One, can't_have_spaces except nbsp_types

Example text One can have spaces


example_subclade
example label with spaces

subitem1 for this clade



subitem2



subitem3



example_subclade_2


subitem2


subitem3_is_a_subclade_of_subclade2

subitemA



subitemB


you_don't_have_to_give_every_item_a_number but_you_can't_control_labels_easily

Z


this_should_label_subitem2 (which doesn't show up) so it drops onto X

X



A



B



C



D



E



FGHIJK


this_should_label_the_box (caused_by_a_space_before_the_data)
FGHIJK


L



abcdefg





mostly sensible clade

subitem1



subitem2



subitem3



Gold star on blue

Gold star on blue.gif


an exploding Star is a

Supernova


Gold star on blue.gifimages in labels move the line too far down.

subitem1



subitem2



subitem3





label for example text 5

Example text 5 can be placed out of order making it harder to edit later, please don't do this.



this is example text 6 - placed where Example text 5 should have gone in the edit tab


second label overwrites first

Example item with no subclade but with two labels (that won't work)


example next set of subclades

subitem1



subitem2



subitem3


this label without nbsp type spaces pushes the line too far down

subitem1



subitem2



subitem3




Style classes[عدل]

قالب:See Also

In the first line of table code, after the "{|", instead of specifying a style directly, you can also specify a CSS class. The style for this class can be specified in various ways:

  • in the software itself, per skin (for example the class sortable)
  • collectively for all users of one wiki in MediaWiki:Common.css (for example, on this and some other projects there is or was the class wikitable, later moved to shared.css)
  • separately per skin in MediaWiki:Monobook.css etc.
  • individually on one wiki in a user subpage
  • individually, but jointly for tables of the class concerned on all web pages, on the local computer of the user.

Instead of remembering table parameters, you just include an appropriate style class after the {|. This helps keep table formatting consistent, and can allow a single change to the class to fix a problem or enhance the look of all the tables that are using it at once. For instance, this:

{| cellpadding="2"
|+ Multiplication table
|-
! scope="col" | &times;
! scope="col" | 1
! scope="col" | 2
! scope="col" | 3
|-
! scope="row" | 1
| 1 || 2 || 3
|-
! scope="row" | 2
| 2 || 4 || 6
|-
! scope="row" | 3
| 3 || 6 || 9
|-
! scope="row" | 4
| 4 || 8 || 12
|-
! scope="row" | 5
| 5 || 10 || 15
|}
Multiplication table
× 1 2 3
1 1 2 3
2 2 4 6
3 3 6 9
4 4 8 12
5 5 10 15
becomes this:
{| class="wikitable"
|+ Multiplication table
|-
! scope="col" | &times;
! scope="col" | 1
! scope="col" | 2
! scope="col" | 3
|-
! scope="row" | 1
| 1 || 2 || 3
|-
! scope="row" | 2
| 2 || 4 || 6
|-
! scope="row" | 3
| 3 || 6 || 9
|-
! scope="row" | 4
| 4 || 8 || 12
|-
! scope="row" | 5
| 5 || 10 || 15
|}
Multiplication table
× 1 2 3
1 1 2 3
2 2 4 6
3 3 6 9
4 4 8 12
5 5 10 15

simply by replacing inline CSS for the table by class="wikitable". This is because the wikitable class in MediaWiki:Common.css contains a number of table.wikitable CSS style rules. These are all applied at once when you mark a table with the class. You can then add additional style rules if desired. These override the class's rules, allowing you to use the class style as a base and build up on it:

Wiki markup

{| class="wikitable" style="font-style:italic; font-size:120%; border: 3px dashed red;"
|+ Multiplication table
|-
! scope="col" | &times;
! scope="col" | 1
! scope="col" | 2
! scope="col" | 3
|-
! scope="row" | 1
| 1 || 2 || 3
|-
! scope="row" | 2
| 2 || 4 || 6
|-
! scope="row" | 3
| 3 || 6 || 9
|-
! scope="row" | 4
| 4 || 8 || 12
|-
! scope="row" | 5
| 5 || 10 || 15
|}

As it appears in a browser:

Multiplication table
× 1 2 3
1 1 2 3
2 2 4 6
3 3 6 9
4 4 8 12
5 5 10 15

Notice that the table retains the gray background of the wikitable class, and the headers are still bold and centered. But now the text formatting has been overridden by the local style statement; all of the text in the table has been made italic and 120% normal size, and the wikitable border has been replaced by the red dashed border.

Of course this works only for browsers supporting inline CSS, if it's important use XHTML markup like <big> instead of "font-size:120%", or Wiki markup like ''text'' instead of "font-style:italic".

Collapsible tables[عدل]

Classes can also be used to collapse tables, so they are hidden by default. Use the style 'collapsible' to enable collapsing behaviour. By default, a collapsible table will begin expanded. To change this, include the additional class 'collapsed' or 'autocollapse' (i.e. only collapse if 3 other collapsible tables are present). You must include a header row, where the 'hide' option will be displayed. Example:

{| class="wikitable collapsible collapsed"
! Header
|-
| Content which starts hidden
|-
| more hidden content
|}

Gives:

Sorting[عدل]

Further information Help:Sorting

Tables can be made sortable by adding class="sortable"; for details see Help:Sorting. Since this can be very useful, it is wise to keep the possibilities and limitations of this feature in mind when designing a table. For example:

  • Do not divide a table into sections by subheaders spanning several rows. Instead, an extra column can be made showing the content of these headers on each row, in a short form.
  • Do not have elements spanning several columns; instead, again, repeat the content on each row, in a short form.
  • In a column of numbers, do not put text such as "ca." in front of a number-it will sort like zero. Do not put text after the number, and do not put a range of numbers (it does not affect the sorting position for numeric sorting mode, and in the case of a range, the first number determines the position, but if, possibly after sorting this or another column, the element is at the top, it will induce alphabetic sorting mode). Instead, put these texts in a separate column. Alternatively, for the greatest flexibility, alphabetic sorting mode with hidden sortkeys can be used.

A long form of abbreviated content can be put as legend outside the table.

Wiki markup

{| class="wikitable sortable" border="1"
|+ Sortable table
|-
! scope="col" | Alphabetic
! scope="col" | Numeric
! scope="col" | Date
! scope="col" class="unsortable" | Unsortable
|-
| d || 20 || 2008-11-24 || This
|-
| b || 8 || 2004-03-01 || column
|-
| a || 6 || 1979-07-23 || cannot
|-
| c || 4 || 1492-12-08 || be
|-
| e || 0 || 1601-08-13 || sorted.
|}

As it appears in a browser:

Sortable table
Alphabetic Numeric Date Unsortable
d 20 2008-11-24 This
b 8 2004-03-01 column
a 6 1979-07-23 cannot
c 4 1492-12-08 be
e 0 1601-08-13 sorted.

Sorting and collapsing[عدل]

It is possible to collapse a sortable table. To do so, you need to use the code {| class="wikitable sortable collapsible". Taking the above table and making it collapsable gives you this:

Wiki markup

{| class="wikitable sortable collapsible" border="1"
|+ Sortable and collapsible table
|-
! scope="col" | Alphabetic
! scope="col" | Numeric
! scope="col" | Date
! scope="col" class="unsortable" | Unsortable
|-
| d || 20 || 2008-11-24 || This
|-
| b || 8 || 2004-03-01 || column
|-
| a || 6 || 1979-07-23 || cannot
|-
| c || 4.2 || 1492-12-08 || be
|-
| e || 0 || 1601-08-13 || sorted.
|}


As it appears in a browser:

Sortable and collapsible table
Alphabetic Numeric Date Unsortable
d 20 2008-11-24 This
b 8 2004-03-01 column
a 6 1979-07-23 cannot
c 4.2 1492-12-08 be
e 0 1601-08-13 sorted.

If you want the table to default to collapsed state, use the code {| class="wikitable sortable collapsible collapsed" in place of {| class="wikitable sortable collapsible"

Row template[عدل]

Regardless of whether wikitable format or HTML is used, the wikitext of the rows within a table, and sometimes even within a collection of tables, has much in common, e.g.:

  • the basic code for a table row
  • code for color, alignment, and sorting mode
  • fixed texts such as units
  • special formats for sorting

In that case it can be useful to create a template that produces the syntax for a table row, with the data as parameters. This can have many advantages:

  • easily changing the order of columns, or removing a column
  • easily adding a new column if many elements of the new column are left blank (if the column is inserted and the existing fields are unnamed, use a named parameter for the new field to avoid adding blank parameter values to many template calls)
  • computing fields from other fields, e.g. population density from population and area
  • duplicating content and providing span tags with "display:none" for the purpose of having one format for sorting and another for display
  • easy specification of a format for a whole column, such as color and alignment

Example:

Using قالب:Pim

{| class="wikitable sortable" border="1"
|-
! scope="col" | a
! scope="col" | b
! scope="col" | a/b
{{help:table/example row template|  50|200}}
{{help:table/example row template|   8| 11}}
{{help:table/example row template|1000| 81}}
|}

gives:

a b a/b

مساعدة:Table/example row template مساعدة:Table/example row template مساعدة:Table/example row template

Conditional table row[عدل]

For a conditional row in a table, we can have:

{| class="wikitable" border="1"
        <!--
                Row one will be shown because the '1' evaluates
                to TRUE.
        -->
        {{ #if:1|{{!}}-
                ! scope="row" {{!}} row one, column one
                <!--
                        Any {{!}}'s will get evaluated to the pipe
                        character '|' since the template '!' just
                        contains '|'.
                -->
                {{!}}row one, column two}}
        <!--
                Row two will not be NOT shown because the space
                between the ':' and the '|' evaluates to FALSE.
        -->
        {{ #if: |{{!}}-
                ! scope="row" {{!}}  row two, column one
                {{!}}row two, column two}}
        <!--
                Row three will be shown.
        -->
        |-
                ! scope="row" {{!}} row three, column one
                | row three, column two
|}

Which gives the following table: (note how the second row is missing)

row one, column one row one, column two
row three, column one row three, column two

Other table syntax[عدل]

Other types of table syntax that MediaWiki supports:

  1. XHTML
  2. HTML & wiki-<td> syntax (Do not use)

All three are supported by MediaWiki and create (currently) valid HTML output, but the pipe syntax is the simplest. Also, HTML & wiki-<td> syntax (i.e., unclosed <td> and <tr> tags) will not necessarily remain browser-supported in the future, especially on handheld internet-accessible devices.

See also HTML element#Tables. Note however that the thead, tbody, tfoot, colgroup, and col elements are currently not supported in MediaWiki.

Comparison of table syntax[عدل]

XHTML Wiki-pipe
Table
<table></table>
{|
|}
Caption
<caption>caption</caption>
|+ caption
Row
<tr></tr>
|-
Data cell
<td>cell1</td><td>cell2</td>
<td>cell3</td>
| cell1 || cell2
| cell3
Header cell
<th scope="col">column heading</th>

<th scope="row">row heading</th>
! scope="col" | column heading

! scope="row" | row heading
Sample table
1 2
3 4
<table>
 <tr>
 <td>1</td>
 <td>2</td>
 </tr>
 <tr>
 <td>3</td>
 <td>4</td>
 </tr>
</table>
{|
| 1 || 2
|-
| 3 || 4
|}
Pros
  • Can preview or debug with any XHTML editor
  • Can be indented for easier reading
  • Well-known
  • Insensitive to newlines
  • No characters like "|" which can collide with template and parser function syntax
  • Easy to write
  • Easy to read
  • Takes little space
  • Can be learned quickly
Cons
  • Tedious
  • Takes a lot of space
  • Difficult to read quickly
  • Accidentally putting "tr" for "td" can cause confusion for hours.
  • Indented code might not match nesting.
  • In rare cases, newlines can break cells, causing severe confusion since newlines usually are ok.
  • Unfamiliar syntax
  • Rigid structure
  • Cannot be indented
  • Text (as in HTML tags) may be easier for some people to read than series of pipes, plus signs, dashes, etc.
  • Requires using Template:! to pass a "|" in a parameter.
  • Sensitive to newlines; see Help:Newlines and spaces.
XHTML Wiki-pipe

See also Template talk:For#Tables.

Pipe syntax in terms of the HTML produced[عدل]

The pipe syntax, developed by Magnus Manske, substitutes pipes (|) for HTML. There is an on-line script which converts html tables to pipe syntax tables.

The pipes must start at the beginning of a new line, except when separating parameters from content or when using || to separate cells on a single line. The parameters are optional.

Tables[عدل]

A table is defined by {| ''params'' |} which generates "<table params></table>".

Rows[عدل]

For each table, an HTML <tr> tag will be generated for the first row. To start a new row, use:

|-

which generates another "<tr>".

Parameters can be added like this:

|- params

which generates "<tr params>".

Note:

  • <tr> tags will be automatically opened at the first <td> equivalent
  • <tr> tags will be automatically closed at <tr> and </table> equivalents

Cells[عدل]

Cells are generated either like this:

|cell1
|cell2
|cell3

or like this:

|cell1||cell2||cell3

which both generate "<td>cell1</td><td>cell2</td><td>cell3</td>". The "||" equals "newline" + "|".

Parameters in cells can be used like this:

|params|cell1||params|cell2||params|cell3

which will result in

<td params>cell1</td>
<td params>cell2</td>
<td params>cell3</td>

Headers[عدل]

Produces a TH, functioning the same way as TD, but with different style. "!" is used instead of the opening "|". "!!" can be used instead of "||". Parameters still use "|", though. Example:

!params|cell1

Captions[عدل]

A <caption> tag is created by

|+ Caption

which generates the HTML "<caption>Caption</caption>".

You can also use parameters:

|+ params|Caption

which will generate "<caption params>Caption</caption>".

Summaries[عدل]

A summary is produced by adding a summary attribute after the start of the table. It can be used by screen readers to give visually impaired readers the overall gist of the table, without having to listen to the entire table. For example:

{| summary="Artistic renderings of Germania became more triumphant and monumental."
| [[File:Philipp Veit 008.jpg|thumb|upright|alt=Robed woman, seated, with sword on her lap|Philipp Veit, ''Germania'', 1834–36]]
| [[File:Image Germania (painting).jpg|thumb|upright|alt=Robed woman, standing, holding a sword|Philipp Veit, ''Germania'', 1848]]
| [[File:Niederwald memorial 2.JPG|thumb|upright|alt=Monument of robed woman, standing, holding a crown in one hand and a partly sheathed sword in another|Johannes Schilling, ''Germania'', 1871–83]]
|}

produces:

Robed woman, seated, with sword on her lap
Philipp Veit, Germania, 1834–36
Robed woman, standing, holding a sword
Philipp Veit, Germania, 1848
Monument of robed woman, standing, holding a crown in one hand and a partly sheathed sword in another
Johannes Schilling, Germania, 1871–83

Square monitors[عدل]

To format for a square monitor or window, use a tape measure. Determine the height of your rectangular screen. Using that figure measure under the screen to determine the width your monitor’s screen would be if it were square. Mark that location using ink or tape under the screen. Drag the side of your browser’s window to that location so the window is square based on accurate measurements. Square monitors and reading windows are not able to contain tables and galleries made for rectangular and wide screens. When a table or gallery is wider than the monitor, it makes every line of text wider than the screen as well. The px amounts of the following gallery were determined after measuring the window to make sure it was square:

Type this:

{| style="background: transparent; margin: auto;"
| [[File:Some window blinds.JPG|192x155px|thumb|left|Various window shades]]
| [[File:Vert-blinds-2145-rs.jpg|192x170px|thumb|left|Vertical blinds]]
| [[File:Gardine.jpg|192x155px|thumb|left|This is not a blind]]
|}

{| style="background: transparent; margin: auto;"
| [[File:Vorhang.jpg|192x155px|thumb|left|Solid shade]]
| [[File:Jalousie-1.jpg|328x55px|thumb|left|Horizonal blinds]]
|}

{| style="background: transparent; margin: auto;"
| [[File:Some_window_blinds.JPG|205px|thumb|left|Shade, shutters; vertical & horizontal blinds.]]
| [[File:Miniblinds detail of mechanism.jpg|388px|thumb|left|<!--
 -->Detail of turning rod (blind stick) attachment on miniblinds]]
|}

For this:

Various window shades
Vertical blinds
This is not a blind
Solid shade
Horizonal blinds
Shade, shutters; vertical & horizontal blinds.
Detail of turning rod (blind stick) attachment on miniblinds

Vertically oriented column headers[عدل]

Sometimes it is desirable (such as in a table predominantly made of numbers) to rotate text such that it proceeds from top to bottom or bottom to top instead of from left to right or right to left. Currently, browser support for this type of styling as a component of HTML or CSS is sporadic (Internet Explorer is one of the few browsers that supports this in cascading stylesheets, albeit in a non-standard way). An alternative solution that works in most if not all browsers is to use images in place of the text. For instance, the following table uses SVG images instead of text to produce the rotated column headings:

Wpvg hd date page.svg Wpvg vg project.svg Wpvg vg talk.svg Wpvg vg portal.svg Wpvg vg article guidelines.svg Wpvg vg templates.svg Wpvg vg sources.svg Wpvg vg assessment.svg Wpvg vg cleanup.svg Wpvg vg requests.svg
05/08 4266 7828 7282 1105 224 161 916 506 231
04/08 4127 6190 6487 1139 241 205 1165 478 301

Normally, one problem with this approach is that readers are directed to different pages when they click on the images. To eliminate this problem—or to direct readers to a different page—you can use the link parameter. A column-header can be coded as follows:


! style="width:3em;" | [[File:wpvg_vg_project.svg|link=xxxx]]

The image will wikilink to article "xxxx".

By setting the link to an empty string (e.g. [[File:wpvg_hd_date_page.svg|link=]]), no navigation will occur when visitors click on an image. Note that it might also be a good idea to color the image text blue if you are using the images as links. Also, SVG is the preferred image format in this case because it can be re-scaled to any size without producing artifacts.

Wikitable as image gallery[عدل]

This section is local to Wikipedia (hard-coded here now).

A wikitable can be used to display side-by-side images, in the manner of an image gallery (formatted by "<gallery>"), but with larger images and less vacant area around photos.

A simple framed gallery can be formatted using class="wikitable" to generate the minimal thin-lines around images/photos within the table:

 {| class="wikitable" border="1"
 |-
 |<!--column1-->[[File:Worms 01.jpg|265px]]
 |<!--column2-->[[File:Worms Wappen 2005-05-27.jpg|235px]]
 |-
 |<!--column1-->Nibelungen Bridge to Worms<br/>across the [[Rhine]]
 |<!--column2-->Worms and its sister cities
 |}<!--end wikitable-->

Note the result below (with thin-lined cells):

Worms 01.jpg Worms Wappen 2005-05-27.jpg
Nibelungen Bridge to Worms
across the Rhine
Worms and its sister cities

Another issue about the standard "<gallery>" tag, in 2007-2008, was that it put 4 images per line, overrunning the right margin of a wiki article displayed in portrait-style width (like 800x600), unless the gallery had only 3 images. However, a wikitable uses typical image-links with sizes, such as "[[Image:XXX.jpg|130px]]" so 4 images could be displayed on a wikitable line within a 600px width (for 800x600 resolution screens).

 {| class="wikitable" border="1"
 |-
 |<!--col1-->[[File:Worms 01.jpg|130px]]
 |<!--col2-->[[File:Worms Wappen 2005-05-27.jpg|125px]]
 |<!--col3-->[[File:Liberty-statue-with-manhattan.jpg|125px]]
 |<!--col4-->[[File:New-York-Jan2005.jpg|125px]]
 |-
 |<!--col1-->Nibelungen Bridge to Worms
 |<!--col2-->Worms and its sister cities
 |<!--col3-->Statue of Liberty
 |<!--col4-->New York City
 |}<!--end wikitable-->
Worms 01.jpg Worms Wappen 2005-05-27.jpg Liberty-statue-with-manhattan.jpg New-York-Jan2005.jpg
Nibelungen Bridge to Worms Worms and its sister cities Statue of Liberty New York City

Another advantage about wikitable images, compared to "<gallery>" formatting, is the ability to "square" each image when similar heights are needed, so consider putting 2-number image sizes (such as "199x95px"), where the 2nd number limits height:

 {| class="wikitable" border="1"
 |-
 |<!--col1-->[[File:Liberty-statue-with-manhattan.jpg|199x95px]]
 |<!--col2-->[[File:New-York-Jan2005.jpg|199x95px]]
 |<!--col3-->[[File:Gold star on blue.gif|199x95px]]
 |<!--col4-->[[File:Worms 01.jpg|100x95px]]<!--smaller-->
 |-
 |<!--col1-->Statue of Liberty
 |<!--col2-->New York City
 |<!--col3-->Star on blue
 |<!--col4-->Bridge to Worms
 |}<!--end wikitable-->

Note the 3 images sized "199x95px" appear identical height, of 95px (4th image purposely smaller). The "95px" forces height, while "199x" fits the various widths (could even be "999x"):

Liberty-statue-with-manhattan.jpg New-York-Jan2005.jpg Gold star on blue.gif Worms 01.jpg
Statue of Liberty New York City Star on blue Bridge to Worms

Therefore, the use of size "199x95px" (or "999x95px") produces the auto-height-sizing beyond the "<gallery>" tag, and with the option to set taller thumbnails ("199x105px"), or even to have some images purposely smaller than other images of "95px" height. A very short height ("70px") allows many more images across the table:

 {| class="wikitable" border="1"
 |-
 |<!--col1-->[[File:Liberty-statue-with-manhattan.jpg|199x70px]]
 |<!--col2-->[[File:Gold star on blue.gif|199x70px]]
 |<!--col3-->[[File:New-York-Jan2005.jpg|199x70px]]
 |<!--col4-->[[File:Gold star on deep red.gif|199x70px]]
 |<!--col5-->[[File:Worms 01.jpg|199x70px]]<!--same height-->
 |<!--col6-->[[File:Gold star on blue.gif|199x70px]]
 |}

The above wikitable-coding produces the result below, of 6 columns:

Liberty-statue-with-manhattan.jpg Gold star on blue.gif New-York-Jan2005.jpg Gold star on deep red.gif Worms 01.jpg Gold star on blue.gif

Once images have been placed in a wikitable, control of formatting can be adjusted when more images are added.

Shifting/centering[عدل]

Images within a wikitable can be shifted by inserting non-breaking spaces ("&nbsp;") before or after the image-link ("&nbsp;[[Image:]]"). However, auto-centering simply requires use of center-tags to be placed around an image-link for centering in a cell ("<center>[[File:..]]</center>").

In the example below, note how Col2 uses <center>, but Col3 uses "&nbsp;":

 {| class="wikitable" border="1"
 |-
 |<!--Col1-->[[File:Domtoren_vanaf_Brigittenstraat.jpg|299x125px]]
 |<!--Col2--><center>[[File:Utrecht 003.jpg|299x125px]]</center>
 |<!--Col3-->&nbsp;[[File:Uitzicht--Domtoren.jpg|299x125px]]&nbsp;
 |-
 |<!--Col1-->Dom tower from Brigittenstraat
 |<!--Col2-->Cloister garth of the Utrecht Dom Church
 |<!--Col3-->&nbsp;&nbsp;<small>View from bell tower</small>
 |}

The above coding generates the table below: note the middle garden image is centered (but not the left image), and the right image has 2 spaces before "  View...":

Domtoren vanaf Brigittenstraat.jpg
Utrecht 003.jpg
 Uitzicht vanaf de Domtoren.jpg 
Dom tower from Brigittenstraat Cloister garth of the Utrecht Dom Church   View from bell tower

Also note that the tag "<small>" made a smaller text-size caption. However, fonts also can be sized by percent (style="font-size: 87%;"), where the actual percent-size as displayed depends on the various sizes allowed for a particular font.

 | style="font-size: 87%;" | View from bell tower

The column attribute, above, uses "style=" to set the font-size for the caption, following the 2nd vertical-bar "|".

A font-size: 65% is very small, while style="font-size: 87%;" is a mid-size font, larger than the tag small.

Speed/transfer rates[عدل]

Actual transfer/display speeds depend on individual files. In 2007 to March 2009 some serious flaws existed in the thumbnailing process when combined with the gallery-display, making thumbnails sometimes larger than the originals. For this reason some users explicitly used tables instead of the gallery tag. However, these issues are fixed as of March 2009.

Generate a chart with a table[عدل]

Using {{visualizer}} or another template that uses {{metavisualizer}}.

Converting spreadsheet to wikitable format[عدل]

To convert from spreadsheets such as Gnumeric, MS Excel or OpenOffice.org Calc, you can use the Copy & Paste Excel-to-Wiki converter or you can save your spreadsheets as .csv and use the csv2wikitable converter.

Tables and WYSIWYG[عدل]

Due to the complexity of wikimarkup (especially tables), a common question is if there is any visual editor to make creating and modifying tables easier. Unfortunately at the moment no such editor exists, however it is possible to create a table with a محرر إتش تي إم إل (like Adobe Dreamweaver) and then copy the html code generated by this into the page.

It is possible in the future that a WYSIWYG editor will be adopted (there has been much discussion about this in the past, however there are many technical hurdles that need to be solved). For the more technically inclined/adventurous tools such as meta:WYSIFTW exist, however they do not incorporate the complete WYSIWYG experience and currently do not support tables (although they may do so in the future).

See also[عدل]

External links[عدل]