آپ «Templates» میں ترمیم کر رہے ہیں

نعت کائنات سے
Jump to navigationJump to search

انتباہ: آپ ویکیپیڈیا میں داخل نہیں ہوئے ہیں۔ لہذا اگر آپ اس صفحہ میں کوئی ترمیم کرتے ہیں تو آپکا آئی پی ایڈریس (IP) اس صفحہ کے تاریخچہ ترمیم میں محفوظ ہوجائے گا۔ اگر آپ لاگ ان ہوتے ہیں یا کھاتہ نہ ہونے کی صورت میں کھاتہ بنا لیتے ہیں تو تو آپ کی ترامیم آپ کے صارف نام سے محفوظ ہوگی، جنھیں آپ کسی بھی وقت ملاحظہ کر سکتے ہیں۔

اس ترمیم کو واپس پھیرا جا سکتا ہے۔ براہ کرم ذیل میں موجود موازنہ ملاحظہ فرمائیں اور یقین کر لیں کہ اس موازنے میں موجود فرق ہی آپ کا مقصود ہے۔ اس کے بعد تبدیلیوں کو شائع کر دیں، ترمیم واپس پھیر دی جائے گی۔

تازہ ترین نسخہ آپ کی تحریر
سطر 1: سطر 1:
<languages/>
__TOC__
{{TNT|PD Help Page}}
:''<translate><!--T:1-->
For MediaWiki's database table structure, see <tvar|1>{{ll|Manual:Database layout}}</></translate>''


<translate>
<!--T:2-->
'''Tables''' may be created in wiki pages.</translate>
<translate>
<!--T:3-->
As a general rule, it is best to avoid using a table unless you need one.</translate>
<translate>
<!--T:4-->
Table markup often complicates page editing.</translate><ref><translate><!--T:5-->
Tables can be created using either XHTML table elements directly, or using wikicode formatting to define the table.</translate>
<translate>
<!--T:6-->
XHTML table elements and their use are well described on various web pages and will not be discussed here.</translate>
<translate>
<!--T:7-->
The benefit of wikicode is that the table is constructed of character symbols which tend to make it easier to perceive the table structure in the article editing view compared to XHTML table elements.</translate></ref>


<translate>
== Tables ==
== Wiki table markup summary == <!--T:8-->
</translate>
{| class="wikitable" style="width:60%"
| style="padding: 10px;"| <big><nowiki>{|</nowiki></big>
| style="padding: 5px;"| <translate><!--T:9-->
'''table start''', ''required''</translate>
|-
| style="padding: 10px;"| <big><nowiki>|+</nowiki></big>
| style="padding: 5px;" | <translate><!--T:10-->
table '''caption''', ''optional;'' only between '''table start''' and '''table row'''</translate>
|-
| style="padding: 10px;"| <big><nowiki>|-</nowiki></big>
| style="padding: 5px;" | <translate><!--T:11-->
'''table row''', ''optional on first row''—wiki engine assumes the first row</translate>
|-
| style="padding: 10px;"| <big><nowiki>!</nowiki></big>
| style="padding: 5px;" | <translate><!--T:12-->
'''table header''' cell, ''optional.''</translate> <translate><!--T:13-->
Consecutive '''table header''' cells may be added on same line separated by double marks (<code>!!</code>) or start on new lines, each with its own single mark (<code>!</code>).</translate>
|-
| style="padding: 10px;"| <big><nowiki>|</nowiki></big>
| style="padding: 5px;" | <translate><!--T:14-->
'''table data''' cell, ''optional''.</translate> <translate><!--T:15-->
Consecutive '''table data''' cells may be added on same line separated by double marks (<code><nowiki>||</nowiki></code>) or start on new lines, each with its own single mark (<code><nowiki>|</nowiki></code>).</translate>
|-
| style="padding: 10px;"| <big><nowiki>|}</nowiki></big>
| style="padding: 5px;" | <translate><!--T:379-->
'''table end''', ''required''</translate>
|}
<translate>
<!--T:16-->
*The above marks must '''start on a new line''' except the double <code>||</code> and <code>!!</code> for optionally adding consecutive cells to a line. However, blank spaces at the beginning of a line are ignored.</translate>
*'''<translate><!--T:17-->
XHTML attributes.</translate>''' <translate><!--T:18-->
Each mark, except table end, optionally accepts one or more XHTML attributes.</translate> <translate><!--T:19-->
Attributes must be on the same line as the mark.</translate> <translate><!--T:20-->
Separate attributes from each other with a single space.</translate>
<translate>
<!--T:21-->
**Cells and caption (<code>|</code> or <code>||</code>, <code>!</code> or <code>!!</code>, and <code>|+</code>) hold content.</translate> <translate><!--T:22-->
So separate any attributes from content with a single pipe (<code>|</code>).</translate> <translate><!--T:23-->
Cell content may follow on same line or on following lines.</translate>
<translate>
<!--T:24-->
**Table and row marks (<code>{|</code> and <code>|-</code>) do not directly hold content.</translate> <translate><!--T:25-->
Do ''not'' add pipe (<code>|</code>) after their optional attributes.</translate> <translate><!--T:26-->
If you erroneously add a pipe after attributes for the table mark or row mark the parser will delete it ''and'' your final attribute if it was touching the erroneous pipe!</translate>
<translate>
<!--T:27-->
*'''Content''' may (a) follow its cell mark on the same line after any optional XHTML attributes or (b) on lines below the cell mark.</translate> <translate><!--T:28-->
Content that uses wiki markup that itself needs to start on a new line, such as lists, headings, or nested tables, must be on its own new line.</translate>
<translate>
<!--T:29-->
**'''Pipe character as content.'''</translate> <translate><!--T:30-->
To insert a pipe (<code>|</code>) character into a table, use the &lt;nowiki&gt;<code>|</code>&lt;/nowiki&gt; escaping markup.</translate>


<translate>
As a security precaution to prevent attacks against the wiki, many HTML tags and all JavaScript is disabled in regular wikitext.  This means that you cannot copy Google AdSense banners, Disqus comment boxes, Facebook like buttons, or any other embeddable objects into the source code of a page.  You should also '''never''' allow any HTML or JavaScript to be useable in page source code because of the severe security vulnerabilities, which include allowing an attacker to gather literally every password used by all wiki users.  By using JavaScript files in the system namespace and allowed HTML in pages, it is possible to add any HTML and JavaScript to wiki pages securely.
==Basics== <!--T:31--></translate>
<translate>
<!--T:32-->
The following table lacks borders and good spacing but shows the simplest wiki markup table structure.</translate>


{| style="width:100%"
== Adding the HTML and JavaScript ==
! style="width: 50%;"|<translate><!--T:404-->
You type</translate>
! style="width: 50%;"|<translate><!--T:405-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{|
|<translate><!--T:33-->
Orange</translate>
|<translate><!--T:34-->
Apple</translate>
|-
|<translate><!--T:35-->
Bread</translate>
|<translate><!--T:36-->
Pie</translate>
|-
|<translate><!--T:37-->
Butter</translate>
|<translate><!--T:38-->
Ice cream</translate>
|}
</pre>
| style="padding: 5px;"|
{|
|<translate><!--T:39-->
Orange</translate>
|<translate><!--T:40-->
Apple</translate>
|-
|<translate><!--T:41-->
Bread</translate>
|<translate><!--T:42-->
Pie</translate>
|-
|<translate><!--T:43-->
Butter</translate>
|<translate><!--T:44-->
Ice cream</translate>
|}
|}
 
<translate>
<!--T:45-->
The cells in the same row can be listed on one line separated by <code>||</code> (two pipe symbols).</translate>
<translate>
<!--T:46-->
If the text in the cell should contain a line break, use <tvar|br><code><nowiki><br /></nowiki></code></> instead.</translate>
 
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:406-->
You type</translate>
! style="width: 50%;"|<translate><!--T:407-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{|
|<translate><!--T:47-->
Orange</translate>||<translate><!--T:392-->
Apple</translate>||<translate><!--T:393-->
more</translate>
|-
|<translate><!--T:48-->
Bread</translate>||<translate><!--T:394-->
Pie</translate>||<translate><!--T:395-->
more</translate>
|-
|<translate><!--T:49-->
Butter</translate>||<translate><!--T:396-->
Ice<br />cream</translate>||<translate><!--T:403-->
and<br />more</translate>
|}
</pre>
| style="padding: 5px;"|
{|
|<translate><!--T:50-->
Orange</translate>||<translate><!--T:397-->
Apple</translate>||<translate><!--T:398-->
more</translate>
|-
|<translate><!--T:51-->
Bread</translate>||<translate><!--T:399-->
Pie</translate>||<translate><!--T:400-->
more</translate>
|-
|<translate><!--T:52-->
Butter</translate>||<translate><!--T:401-->
Ice<br />cream</translate>||<translate><!--T:402-->
and<br />more</translate>
|}
|}
 
<translate>
<!--T:53-->
Extra spaces within cells in the wiki markup, as in the wiki markup below, do not affect the actual table rendering.</translate>
 
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:408-->
You type</translate>
! style="width: 50%;"|<translate><!--T:409-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{|
|  <translate><!--T:54-->
Orange</translate> || <translate><!--T:380-->
Apple</translate> || <translate><!--T:381-->
more</translate>
|-
|  <translate><!--T:55-->
Bread</translate> || <translate><!--T:382-->
Pie</translate> || <translate><!--T:383-->
more</translate>
|-
|  <translate><!--T:56-->
Butter</translate> || <translate><!--T:384-->
Ice cream</translate> || <translate><!--T:385-->
and more</translate>
|}
</pre>
| style="padding: 5px;"|
{|
|  <translate><!--T:57-->
Orange</translate> || <translate><!--T:386-->
Apple</translate> || <translate><!--T:387-->
more</translate>
|-
|  <translate><!--T:58-->
Bread</translate> || <translate><!--T:388-->
Pie</translate> || <translate><!--T:389-->
more</translate>
|-
|  <translate><!--T:59-->
Butter</translate> || <translate><!--T:390-->
Ice cream</translate> || <translate><!--T:391-->
and more</translate>
|}
|}
 
<translate>
<!--T:60-->
You can have longer text or more complex wiki syntax inside table cells, too:</translate>
 
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:410-->
You type</translate>
! style="width: 50%;"|<translate><!--T:411-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{|
|Lorem ipsum dolor sit amet,
consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt
ut labore et dolore magna aliquyam erat,
sed diam voluptua.
 
At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum
dolor sit amet.
|
* Lorem ipsum dolor sit amet
* consetetur sadipscing elitr
* sed diam nonumy eirmod tempor invidunt
|}
</pre>
| style="padding: 5px;"|
{|
|Lorem ipsum dolor sit amet,
consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt
ut labore et dolore magna aliquyam erat,
sed diam voluptua.
 
At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum
dolor sit amet.
|
* Lorem ipsum dolor sit amet
* consetetur sadipscing elitr
* sed diam nonumy eirmod tempor invidunt
|}
|}
 
<translate>
=== Table headers === <!--T:61--></translate>
<translate>
<!--T:62-->
Table headers can be created by using "<code>!</code>" (exclamation mark) instead of "<code>|</code>" (pipe symbol).</translate>
<translate>
<!--T:63-->
Headers usually show up bold and centered by default.</translate>
 
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:64-->
You type</translate>
! style="width: 50%;"|<translate><!--T:65-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{|
! style="text-align:left;"| <translate><!--T:66-->
Item</translate>
! <translate><!--T:67-->
Amount</translate>
! <translate><!--T:68-->
Cost</translate>
|-
|<translate><!--T:69-->
Orange</translate>
|10
|7.00
|-
|<translate><!--T:70-->
Bread</translate>
|4
|3.00
|-
|<translate><!--T:71-->
Butter</translate>
|1
|5.00
|-
!<translate><!--T:72-->
Total</translate>
|
|15.00
|}
</pre>
| style="padding: 5px;"|
{|
! style="text-align:left;"| <translate><!--T:73-->
Item</translate>
! <translate><!--T:74-->
Amount</translate>
! <translate><!--T:75-->
Cost</translate>
|-
|<translate><!--T:76-->
Orange</translate>
|10
|7.00
|-
|<translate><!--T:77-->
Bread</translate>
|4
|3.00
|-
|<translate><!--T:78-->
Butter</translate>
|1
|5.00
|-
!<translate><!--T:79-->
Total</translate>
|
|15.00
|}
|}
 
<translate>
<!--T:80-->
'''Note:''' When using attributes as in the heading 'Item' a vertical bar '|' is used for separation.</translate>
<translate>
<!--T:81-->
Not an exclamation character '!'.</translate>
 
<translate>
===Caption=== <!--T:82--></translate>
<translate>
<!--T:83-->
A '''table caption''' can be added to the top of any table as follows.</translate>
 
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:84-->
You type</translate>
! style="width: 50%;"|<translate><!--T:85-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{|
|+<translate><!--T:86-->
Food complements</translate>
|-
|<translate><!--T:87-->
Orange</translate>
|<translate><!--T:88-->
Apple</translate>
|-
|<translate><!--T:89-->
Bread</translate>
|<translate><!--T:90-->
Pie</translate>
|-
|<translate><!--T:91-->
Butter</translate>
|<translate><!--T:92-->
Ice cream</translate>
|}
</pre>
| style="padding: 5px;"|
{|
|+ <translate><!--T:93-->
Food complements</translate>
|-
|<translate><!--T:94-->
Orange</translate>
|<translate><!--T:95-->
Apple</translate>
|-
|<translate><!--T:96-->
Bread</translate>
|<translate><!--T:97-->
Pie</translate>
|-
|<translate><!--T:98-->
Butter</translate>
|<translate><!--T:99-->
Ice cream</translate>
|}
|}


<translate>
=== Creating the script ===
=== class="wikitable" === <!--T:100-->


<!--T:101-->
JavaScript programs can be written on the MediaWiki:Common.js page on your wiki. You will need to write JavaScript even if you only are using HTML because JavaScript is what will add the HTML elements to the page.
Basic styling (light gray background, borders, padding and align left) can be achieved by adding class="wikitable".</translate>


{| style="width:100%"
In case of HTML content, the script will contain the HTML you want to add and identify where to put it.
! style="width: 50%;"|<translate><!--T:102-->
You type</translate>
! style="width: 50%;"|<translate><!--T:103-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable"
|+<translate><!--T:104-->
Food complements</translate>
|-
|<translate><!--T:105-->
Orange</translate>
|<translate><!--T:106-->
Apple</translate>
|-
|<translate><!--T:107-->
Bread</translate>
|<translate><!--T:108-->
Pie</translate>
|-
|<translate><!--T:109-->
Butter</translate>
|<translate><!--T:110-->
Ice cream</translate>
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable"
|+ <translate><!--T:111-->
Food complements</translate>
|-
|<translate><!--T:112-->
Orange</translate>
|<translate><!--T:113-->
Apple</translate>
|-
|<translate><!--T:114-->
Bread</translate>
|<translate><!--T:115-->
Pie</translate>
|-
|<translate><!--T:116-->
Butter</translate>
|<translate><!--T:117-->
Ice cream</translate>
|}
|}


<translate>
Use the following example to write your script.
===HTML colspan and rowspan=== <!--T:118--></translate>


<translate>
<source lang="javascript">
<!--T:119-->
$(function () {
You can use HTML '''colspan''' and '''rowspan''' attributes on cells for advanced layout.</translate>


{| style="width:100%"
  var myElement = document.getElementById('mw-mywiki-example');
! style="width: 50%;"|<translate><!--T:412-->
  myElement.innerHTML = 'any HTML';
You type</translate>
! style="width: 50%;"|<translate><!--T:413-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable"
!colspan="6"|<translate><!--T:120-->
Shopping List</translate>
|-
|rowspan="2"|<translate><!--T:121-->
Bread & Butter</translate>
|<translate><!--T:122-->
Pie</translate>
|<translate><!--T:123-->
Buns</translate>
|<translate><!--T:124-->
Danish</translate>
|colspan="2"|<translate><!--T:125-->
Croissant</translate>
|-
|<translate><!--T:126-->
Cheese</translate>
|colspan="2"|<translate><!--T:127-->
Ice cream</translate>
|<translate><!--T:128-->
Butter</translate>
|<translate><!--T:129-->
Yogurt</translate>
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable"
!colspan="6"|<translate><!--T:130-->
Shopping List</translate>
|-
|rowspan="2"|<translate><!--T:131-->
Bread & Butter</translate>
|<translate><!--T:132-->
Pie</translate>
|<translate><!--T:133-->
Buns</translate>
|<translate><!--T:134-->
Danish</translate>
|colspan="2"|<translate><!--T:135-->
Croissant</translate>
|-
|<translate><!--T:136-->
Cheese</translate>
|colspan="2"|<translate><!--T:137-->
Ice cream</translate>
|<translate><!--T:138-->
Butter</translate>
|<translate><!--T:139-->
Yogurt</translate>
|}
|}


<translate>
}());
== XHTML attributes == <!--T:140--></translate>
</source>
<translate>
<!--T:141-->
You can add XHTML attributes to tables.</translate>
<translate>
<!--T:142-->
For the authoritative source on these, see [<tvar|url>https://www.w3.org/TR/html-markup/table.html</> the W3C's HTML Specification page on tables].</translate>


<translate>
[[jQuery]] is also shipped with MediaWiki core. You can write your script like this:
=== Attributes on tables === <!--T:143--></translate>
<translate>
<!--T:144-->
Placing attributes after the table start tag (<code>{|</code>) applies attributes to the entire table.</translate>


{| style="width:100%"
<source lang="javascript">
! style="width: 50%;"| <translate><!--T:145-->
$(function () {
You type</translate>
  $('#mw-mywiki-example').html('any HTML');
! style="width: 50%;"| <translate><!--T:146-->
}());
You get</translate>
</source>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable" style="text-align: center; color: green;"
|<translate><!--T:147-->
Orange</translate>
|<translate><!--T:148-->
Apple</translate>
|12,333.00
|-
|<translate><!--T:149-->
Bread</translate>
|<translate><!--T:150-->
Pie</translate>
|500.00
|-
|<translate><!--T:151-->
Butter</translate>
|<translate><!--T:152-->
Ice cream</translate>
|1.00
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable" style="text-align: center; color: green;"
|<translate><!--T:153-->
Orange</translate>
|<translate><!--T:154-->
Apple</translate>
|12,333.00
|-
|<translate><!--T:155-->
Bread</translate>
|<translate><!--T:156-->
Pie</translate>
|500.00
|-
|<translate><!--T:157-->
Butter</translate>
|<translate><!--T:158-->
Ice cream</translate>
|1.00
|}
|}


<translate>
When copying the script, change <code>mw-mywiki-example</code> to the identifier you will use inside your wiki page.  For example, ''mw-unicornwiki-ads''.
=== Attributes on cells === <!--T:159--></translate>
<translate>
<!--T:160-->
You can put attributes on individual '''cells'''.</translate>
<translate>
<!--T:161-->
For example, numbers may look better aligned right.</translate>


{| style="width:100%"
To add the HTML or JavaScript, change <code>any HTML</code> to whatever HTML code that you want. Be careful about double and single quotes and use JavaScript escape characters where necessary.
! style="width: 50%;"| <translate><!--T:162-->
You type</translate>
! style="width: 50%;"| <translate><!--T:163-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable"
| <translate><!--T:164-->
Orange</translate>
| <translate><!--T:165-->
Apple</translate>
| style="text-align:right;" | 12,333.00
|-
| <translate><!--T:166-->
Bread</translate>
| <translate><!--T:167-->
Pie</translate>
| style="text-align:right;" | 500.00
|-
| <translate><!--T:168-->
Butter</translate>
| <translate><!--T:169-->
Ice cream</translate>
| style="text-align:right;" | 1.00
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable" style="text-align:center"
| <translate><!--T:170-->
Orange</translate>
| <translate><!--T:171-->
Apple</translate>
| style="text-align:right;" | 12,333.00
|-
| <translate><!--T:172-->
Bread</translate>
| <translate><!--T:173-->
Pie</translate>
| style="text-align:right;" | 500.00
|-
| <translate><!--T:174-->
Butter</translate>
| <translate><!--T:175-->
Ice cream</translate>
| style="text-align:right;" | 1.00
|}
|}


<translate>
==== Separate script ====
<!--T:176-->
You can also use '''cell''' attributes when you are listing multiple '''cells''' on a single line.</translate>
<translate>
<!--T:177-->
Note that the '''cells''' are separated by <code>||</code>, and within each '''cell''' the attribute(s) and value are separated by <code>|</code>.</translate>


{| style="width:100%"
If your script gets too long or you want to keep snippets from a third-party library separate, you can create a new file in the MediaWiki namespace (ending in <code>.js</code>), e.g. <code>MediaWiki:Example.js</code>. And then instruct MediaWiki to import that script. To do this, add an import script instruction to MediaWiki:Common.js:
! style="width: 50%;"| <translate><!--T:178-->
You type</translate>
! style="width: 50%;"| <translate><!--T:179-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable"
| <translate><!--T:180-->
Orange</translate> || <translate><!--T:373-->
Apple</translate>     || style="text-align:right;" | 12,333.00
|-
| <translate><!--T:181-->
Bread</translate> || <translate><!--T:374-->
Pie</translate>      || style="text-align:right;" | 500.00
|-
| <translate><!--T:182-->
Butter</translate> || <translate><!--T:375-->
Ice cream</translate> || style="text-align:right;" | 1.00
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable"
| <translate><!--T:183-->
Orange</translate> || <translate><!--T:376-->
Apple</translate>    || style="text-align:right;" | 12,333.00
|-
| <translate><!--T:184-->
Bread</translate> || <translate><!--T:377-->
Pie</translate>      || style="text-align:right;" | 500.00
|-
| <translate><!--T:185-->
Butter</translate> || <translate><!--T:378-->
Ice cream</translate> || style="text-align:right;" | 1.00
|}
|}


<translate>
===Attributes on rows=== <!--T:186--></translate>
<translate>
<!--T:187-->
You can put attributes on individual '''rows''', too.</translate>
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:188-->
You type</translate>
! style="width: 50%;"|<translate><!--T:189-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
<pre>
{| class="wikitable"
importScript('MediaWiki:Example.js');
| <translate><!--T:190-->
Orange</translate>
| <translate><!--T:191-->
Apple</translate>
| style="text-align:right;"| 12,333.00
|-
| <translate><!--T:192-->
Bread</translate>
| <translate><!--T:193-->
Pie</translate>
| style="text-align:right;"| 500.00
|- style="font-style: italic; color: green;"
| <translate><!--T:194-->
Butter</translate>
| <translate><!--T:195-->
Ice cream</translate>
| style="text-align:right;"| 1.00
|}
</pre>
</pre>
| style="padding: 5px;"|
{| class="wikitable"
| <translate><!--T:196-->
Orange</translate>
| <translate><!--T:197-->
Apple</translate>
| style="text-align:right;"| 12,333.00
|-
| <translate><!--T:198-->
Bread</translate>
| <translate><!--T:199-->
Pie</translate>
| style="text-align:right;"| 500.00
|- style="font-style: italic; color: green;"
| <translate><!--T:200-->
Butter</translate>
| <translate><!--T:201-->
Ice cream</translate>
| style="text-align:right;"| 1.00
|}
|}


<translate>
=== Enable on a wiki page ===
===Simple one-pixel table border=== <!--T:202--></translate>
<translate>
<!--T:203-->
An example of a one-pixel table border:</translate>
 
{| style="width:100%"
|-
! style="width:50%" | <translate><!--T:204-->
You type</translate>
! style="width:50%" | <translate><!--T:205-->
You get</translate>
|-
| style="padding: 5px;" |
<pre>
{| border="1" style="border-collapse:collapse"
| <translate><!--T:206-->
Orange</translate>
| <translate><!--T:207-->
Apple</translate>
|-
| <translate><!--T:208-->
Bread</translate>
| <translate><!--T:209-->
Pie</translate>
|}
</pre>
| style="padding: 20px;"|
{| border="1" style="border-collapse:collapse"
| <translate><!--T:210-->
Orange</translate>
| <translate><!--T:211-->
Apple</translate>
|-
| <translate><!--T:212-->
Bread</translate>
| <translate><!--T:213-->
Pie</translate>
|}
|}


<translate>
To begin adding the new object to wiki pages, create a template.  For example, it could be called ''Template:Advertisement''.
===Border width=== <!--T:214--></translate>
<translate>
<!--T:215-->
If "border-width:" has only one number, it is for all four border sides:</translate>
{| style="width:100%"
|-
! style="width:50%" | <translate><!--T:216-->
You type</translate>
! style="width:50%" | <translate><!--T:217-->
You get</translate>
|-
| style="padding: 5px;" |
<pre>
{|style="border-style: solid; border-width: 20px"
|
<translate><!--T:218-->
Hello</translate>
|}
</pre>
| style="padding: 20px;"|
{|style="border-style: solid; border-width: 20px"
|
<translate><!--T:219-->
Hello</translate>
|}
|}


<translate>
Add the following code to the template.  Make sure the ID matches the identifier you specified in your script earlier.
<!--T:220-->
If "border-width:" has more than one number, the four numbers are for '''top, right, bottom, left (REMEMBER this order)''':</translate>


{| style="width:100%"
|-
! style="width:50%" | <translate><!--T:221-->
You type</translate>
! style="width:50%" | <translate><!--T:222-->
You get</translate>
|-
| style="padding: 5px;" |
<pre>
<pre>
{|style="border-style: solid; border-width: 10px 20px 100px 0"
<div id="mw-mywiki-example"></div>
|
<translate><!--T:223-->
Hello</translate>
|}
</pre>
</pre>
| style="padding: 20px;"|
{|style="border-style: solid; border-width: 10px 20px 100px 0"
|
<translate><!--T:224-->
Hello</translate>
|}
|}


<translate>
You can use any tags or attributes to style the template and the content being added. Just make sure that you keep the identifier the same.
<!--T:225-->
:When there are fewer than 4 values, the value for left takes its default from the value for right, the value for bottom takes its default from the value for top, and the value for right takes its default from the value for top.</translate>


<translate>
Enable it on a page by including the template on any wiki page(s) you want the script to apply:
<!--T:226-->
Another method to define the widths of the four sides of a cell is to use ''"border-left", "border-right", "border-top" and "border-bottom"'':</translate>
<div style="width: 100%; overflow:auto;">
{| style="width:100%"
|-
! style="width:50%" | <translate><!--T:227-->
You type</translate>
! style="width:50%" | <translate><!--T:228-->
You get</translate>
|-
| style="padding: 5px;" |
<pre>
{|style="border-left:solid 10px black;border-right:solid 20px black;border-top:solid 30px black;border-bottom:solid 40px black;" align="center"
|
<translate><!--T:229-->
Hello</translate>
|}
</pre>
| style="padding: 20px;"|
{|style="border-left:solid 10px black;border-right:solid 20px black;border-top:solid 30px black;border-bottom:solid 40px black;" align="center"
|
<translate><!--T:230-->
Hello</translate>
|}
|}
</div>


{{TNT|Note}}
<translate><!--T:231-->
* The HTML attributes (such as "width=", "border=", "cellspacing=", "cellpadding=") do not need any length unit (the pixel unit is assumed).</translate> <translate><!--T:414-->
They are also invalid in HTML 5.</translate>
<translate>
<!--T:232-->
The CSS style properties (which override the HTML attributes) require an explicit length unit (if the value is not 0) such as "px" for the pixel.</translate>
<translate>
===With HTML attributes and CSS styles=== <!--T:233--></translate>
<translate>
<!--T:234-->
[[Special:MyLanuage/Manual:CSS|CSS]] style attributes can be added with or without other HTML attributes.</translate>
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:235-->
You type</translate>
! style="width: 50%;"|<translate><!--T:236-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
<pre>
{| class="wikitable" style="color:green; background-color:#ffffcc;" cellpadding="10"
{{Advertisement}}
|<translate><!--T:237-->
Orange</translate>
|<translate><!--T:238-->
Apple</translate>
|-
|<translate><!--T:239-->
Bread</translate>
|<translate><!--T:240-->
Pie</translate>
|-
|<translate><!--T:241-->
Butter</translate>
|<translate><!--T:242-->
Ice cream</translate>
|}
</pre>
</pre>
| style="padding: 5px;"|
{| class="wikitable" style="color:green; background-color:#ffffcc;" cellpadding="10"
|<translate><!--T:243-->
Orange</translate>
|<translate><!--T:244-->
Apple</translate>
|-
|<translate><!--T:245-->
Bread</translate>
|<translate><!--T:246-->
Pie</translate>
|-
|<translate><!--T:247-->
Butter</translate>
|<translate><!--T:248-->
Ice cream</translate>
|}
|}
<translate>
====Attributes==== <!--T:249--></translate>
<translate>
<!--T:250-->
'''Attributes''' can be added to the caption and headers as follows.</translate>
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:251-->
You type</translate>
! style="width: 50%;"|<translate><!--T:252-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable"
|+ style="caption-side:bottom; color:#e76700;"|<translate><!--T:253-->
''Food complements''</translate>
|-
|<translate><!--T:254-->
Orange</translate>
|<translate><!--T:255-->
Apple</translate>
|-
|<translate><!--T:256-->
Bread</translate>
|<translate><!--T:257-->
Pie</translate>
|-
|<translate><!--T:258-->
Butter</translate>
|<translate><!--T:259-->
Ice cream</translate>
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable"
|+ style="caption-side:bottom; color:#e76700;"|<translate><!--T:260-->
''Food complements''</translate>
|-
|<translate><!--T:261-->
Orange</translate>
|<translate><!--T:262-->
Apple</translate>
|-
|<translate><!--T:263-->
Bread</translate>
|<translate><!--T:264-->
Pie</translate>
|-
|<translate><!--T:265-->
Butter</translate>
|<translate><!--T:266-->
Ice cream</translate>
|}
|}
<translate>
====Column width==== <!--T:267--></translate>
<translate>
<!--T:268-->
'''Column width''' can be added as follows.</translate>
<translate>
<!--T:269-->
You type:</translate>
<pre>
{| style="color: black; background-color: #ffffcc; width: 85%;"
| colspan="2" | <translate><!--T:270-->
This column width is 85% of the screen width (and has a background color)</translate>
|-
| style="width: 30%; background-color: white;"|
<translate><!--T:271-->
'''This column is 30% counted from 85% of the screen width'''</translate>
| style="width: 70%; background-color: orange;"|
<translate><!--T:272-->
'''This column is 70% counted from 85% of the screen width (and has a background color)'''</translate>
|}
</pre>
<translate>
<!--T:273-->
You get:</translate>
{| style="color: black; background-color: #ffffcc; width: 85%;"
| colspan="2" | <translate><!--T:274-->
This column width is 85% of the screen width (and has a background color)</translate>
|-
| style="width: 30%; background-color: white;"| <translate><!--T:275-->
'''This column is 30% counted from 85% of the screen width'''</translate>
| style="width: 70%; background-color: orange;"| <translate><!--T:276-->
'''This column is 70% counted from 85% of the screen width (and has a background color)'''</translate>
|}
<translate>
===Accessibility of table header cells=== <!--T:277--></translate>
<translate>
<!--T:278-->
Table header cells do not explicitly specify which table data cells they apply to (those on their right on the same row, or those below them on the same column).</translate>
<translate>
<!--T:279-->
When the table is rendered in a visual 2D environment, this is usually easy to infer.</translate>
<translate>
<!--T:280-->
However when tables are rendered on non-visual media, you can help the browser to determine which table header cell applies to the description of any selected cell (in order to repeat its content in some accessibility helper) using a scope="row" or scope="col" attribute on table header cells.</translate>
<translate>
<!--T:281-->
In most cases with simple tables, you'll use scope="col" on all header cells of the first row, and scope="row" on the first cell of the following rows:</translate>
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:282-->
You type</translate>
! style="width: 50%;"|<translate><!--T:283-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable"
|-
! scope="col"| <translate><!--T:284-->
Item</translate>
! scope="col"| <translate><!--T:285-->
Quantity</translate>
! scope="col"| <translate><!--T:286-->
Price</translate>
|-
! scope="row"| <translate><!--T:287-->
Bread</translate>
| 0.3 kg
| $0.65
|-
! scope="row"| <translate><!--T:288-->
Butter</translate>
| 0.125 kg
| $1.25
|-
! scope="row" colspan="2"| <translate><!--T:289-->
Total</translate>
| $1.90
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable"
|-
! scope="col"| <translate><!--T:290-->
Item</translate>
! scope="col"| <translate><!--T:291-->
Quantity</translate>
! scope="col"| <translate><!--T:292-->
Price</translate>
|-
! scope="row"| <translate><!--T:293-->
Bread</translate>
| 0.3 kg
| $0.65
|-
! scope="row"| <translate><!--T:294-->
Butter</translate>
| 0.125 kg
| $1.25
|-
! scope="row" colspan="2"| <translate><!--T:295-->
Total</translate>
| $1.90
|}
|}
<translate>
== Alignment == <!--T:296--></translate>
<translate>
=== Table alignment === <!--T:297--></translate>
<translate>
<!--T:298-->
Table alignment is achieved by using CSS.</translate>
<translate>
<!--T:299-->
The table alignment is controlled by margins.</translate>
<translate>
<!--T:300-->
A fixed margin on one side will make the table to be aligned to that side, if on the opposite side the margin is defined as ''auto''.</translate>
<translate>
<!--T:301-->
To have a table center aligned, you should set both margins to ''auto''</translate>
<translate>
<!--T:302-->
For example, a right-aligned table:</translate>
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:303-->
You type</translate>
! style="width: 50%;"|<translate><!--T:304-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable" style="margin-left: auto; margin-right: 0px;"
| <translate><!--T:305-->
Orange</translate>
| <translate><!--T:306-->
Apple</translate>
|-
| <translate><!--T:307-->
Bread</translate>
| <translate><!--T:308-->
Pie</translate>
|-
| <translate><!--T:309-->
Butter</translate>
| <translate><!--T:310-->
Ice cream</translate>
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable" style="margin-left: auto; margin-right: 0px;"
| <translate><!--T:311-->
Orange</translate>
| <translate><!--T:312-->
Apple</translate>
|-
| <translate><!--T:313-->
Bread</translate>
| <translate><!--T:314-->
Pie</translate>
|-
| <translate><!--T:315-->
Butter</translate>
| <translate><!--T:316-->
Ice cream</translate>
|}
|}
<translate>
<!--T:317-->
And a center-aligned table:</translate>
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:318-->
You type</translate>
! style="width: 50%;"|<translate><!--T:319-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable" style="margin: auto;"
| <translate><!--T:320-->
Orange</translate>
| <translate><!--T:321-->
Apple</translate>
|-
| <translate><!--T:322-->
Bread</translate>
| <translate><!--T:323-->
Pie</translate>
|-
| <translate><!--T:324-->
Butter</translate>
| <translate><!--T:325-->
Ice cream</translate>
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable" style="margin: auto;"
| <translate><!--T:326-->
Orange</translate>
| <translate><!--T:327-->
Apple</translate>
|-
| <translate><!--T:328-->
Bread</translate>
| <translate><!--T:329-->
Pie</translate>
|-
| <translate><!--T:330-->
Butter</translate>
| <translate><!--T:331-->
Ice cream</translate>
|}
|}
<translate>
=== Table floating around text === <!--T:332--></translate>
<translate>
<!--T:333-->
If you align a table to the right or the left side of the page, the text that comes after the table starts at the end of it, leaving an empty space around the table.</translate>
<translate>
<!--T:334-->
You can make the text to be wrapped around the table by making the table to ''float'' around the text instead of just aligning it.</translate>
<translate>
<!--T:335-->
This can be achieved using the <code>float</code> CSS attribute, which can specify where the table floats to the right side or to the left.</translate>
<translate>
<!--T:336-->
When using ''float'', margins doesn't control table alignment and can be used to specify the margin between the table and the surrounding text.</translate>
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:337-->
You type</translate>
! style="width: 50%;"|<translate><!--T:338-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable" style="float:right; margin-left: 10px;"
| <translate><!--T:339-->
Orange</translate>
| <translate><!--T:340-->
Apple</translate>
|-
| <translate><!--T:341-->
Bread</translate>
| <translate><!--T:342-->
Pie</translate>
|-
| <translate><!--T:343-->
Butter</translate>
| <translate><!--T:344-->
Ice cream</translate>
|}
Lorem ipsum dolor sit amet, consectetuer adipiscing
elit, sed diam nonummy nibh euismod tincidunt ut
laoreet dolore magna aliquam erat volutpat. Ut wisi
enim ad minim veniam, quis nostrud exerci tation
ullamcorper suscipit lobortis nisl ut aliquip ex ea
commodo consequat. Duis autem vel eum iriure dolor
in hendrerit in vulputate velit esse molestie consequat,
vel illum dolore eu feugiat nulla facilisis at vero
eros et accumsan et iusto odio dignissim qui blandit
praesent luptatum zzril delenit augue duis dolore te
feugait nulla facilisi.
</pre>
| style="padding: 5px;"|
{| class="wikitable" style="float:right; margin-left: 10px;"
| <translate><!--T:345-->
Orange</translate>
| <translate><!--T:346-->
Apple</translate>
|-
| <translate><!--T:347-->
Bread</translate>
| <translate><!--T:348-->
Pie</translate>
|-
| <translate><!--T:349-->
Butter</translate>
| <translate><!--T:350-->
Ice cream</translate>
|}
Lorem ipsum dolor sit amet, consectetuer adipiscing
elit, sed diam nonummy nibh euismod tincidunt ut
laoreet dolore magna aliquam erat volutpat. Ut wisi
enim ad minim veniam, quis nostrud exerci tation
ullamcorper suscipit lobortis nisl ut aliquip ex ea
commodo consequat. Duis autem vel eum iriure dolor
in hendrerit in vulputate velit esse molestie consequat,
vel illum dolore eu feugiat nulla facilisis at vero
eros et accumsan et iusto odio dignissim qui blandit
praesent luptatum zzril delenit augue duis dolore te
feugait nulla facilisi.
|}
<translate>
=== Cell contents alignment === <!--T:351--></translate>
<translate>
<!--T:352-->
The alignment of cell contents can be controlled with 2 different CSS properties: <code>text-align</code> and <code>vertical-align</code>.</translate>
<translate>
<!--T:353-->
<code>text-align</code> can be specified at the table, row or individual cells, while <code>vertical-align</code> only can be specified at individual rows or cells.</translate>
{| style="width:100%"
! style="width: 50%;"|<translate><!--T:354-->
You type</translate>
! style="width: 50%;"|<translate><!--T:355-->
You get</translate>
|-
| style="padding: 5px;"|
<pre>
{| class="wikitable"
|- style="vertical-align:top;"
| style="height:100px; width:100px; text-align:left;" | A
| style="height:100px; width:100px; text-align:center;" | B
| style="height:100px; width:100px; text-align:right;" | C
|- style="vertical-align:middle;"
| style="height:100px; width:100px; text-align:left;" | D
| style="height:100px; width:100px; text-align:center;" | E
| style="height:100px; width:100px; text-align:right;" | F
|- style="vertical-align:bottom;"
| style="height:100px; width:100px; text-align:left;" | G
| style="height:100px; width:100px; text-align:center;" | H
| style="height:100px; width:100px; text-align:right;" | I
|}
</pre>
| style="padding: 5px;"|
{| class="wikitable"
|- style="vertical-align:top;"
| style="height:100px; width:100px; text-align:left;" | A
| style="height:100px; width:100px; text-align:center;" | B
| style="height:100px; width:100px; text-align:right;" | C
|- style="vertical-align:middle;"
| style="height:100px; width:100px; text-align:left;" | D
| style="height:100px; width:100px; text-align:center;" | E
| style="height:100px; width:100px; text-align:right;" | F
|- style="vertical-align:bottom;"
| style="height:100px; width:100px; text-align:left;" | G
| style="height:100px; width:100px; text-align:center;" | H
| style="height:100px; width:100px; text-align:right;" | I
|}
|}
<translate>
==Caveats== <!--T:356--></translate>
<translate>
===Negative numbers=== <!--T:357--></translate>
<translate>
<!--T:358-->
If you start a cell on a new line with a negative number with a minus sign (or a parameter that evaluates to a negative number), your table can get broken, because the characters <code>|-</code> will be parsed as the wiki markup for table row, not table cell.</translate>
<translate>
<!--T:359-->
To avoid this, insert a space before the value (<code>| -6</code>) or use in-line cell markup (<code>|| -6</code>).</translate>
<translate>
===CSS vs attributes=== <!--T:360--></translate>
<translate>
<!--T:361-->
Table borders specified through CSS rather than the border attribute will render incorrectly in a small subset of text browsers.</translate>
<translate>
===Common attributes for columns, column groups and row groups=== <!--T:362--></translate>
<translate>
<!--T:363-->
The MediaWiki syntax for tables currently offers no support for specifying common attributes for columns (with the HTML element <code><nowiki><col /></nowiki></code>), column groups (HTML element <code><nowiki><colgroup></colgroup></nowiki></code>) and row groups (HTML elements <code><nowiki><thead></thead></nowiki></code>, <code><nowiki><tbody></tbody></nowiki><code> and <code><nowiki><tfoot></tfoot></nowiki></code>).</translate>
<translate>
<!--T:364-->
Those standard HTML elements are not accepted even in their HTML or XHTML syntax.</translate>
<translate>
<!--T:365-->
All the rows and cells (header or data) of the table are rendered within a single implicit row group (HTML element <code><nowiki><tbody></tbody></nowiki></code>) without any attributes or styles.</translate>
<translate>
==See also== <!--T:366--></translate>
<translate>
<!--T:367-->
* [[Special:MyLanguage/Help:Sorting#Sorting rows of a table|Sorting rows of a table]]
</translate>
* {{mediawiki|meta:Help:Sorting}}
* {{mediawiki|wikipedia:Help:Tables}}
<translate>
<!--T:370-->
* [http://www.tablesgenerator.com/mediawiki_tables Easy tool that helps generating tables]</translate>
<translate>
<!--T:371-->
* {{mediawiki|wikipedia:Template:Horizontal TOC}}. Good for country lists in table format.</translate>
<translate>
==Notes== <!--T:372-->
</translate>
<references/>
[[Category:Help{{#translation:}}|Tables]]
براہ کرم اس بات کا خیال رکھیں کہ نعت کائنات میں آپ کی جانب سے کی جانے والی تمام ترمیموں میں دیگر صارفین بھی حذف و اضافہ کر سکتے ہیں۔ اگر آپ اپنی تحریر کے ساتھ اس قسم کے سلوک کے روادار نہیں تو براہ کرم اسے یہاں شائع نہ کریں۔
نیز اس تحریر کو شائع کرتے وقت آپ ہم سے یہ وعدہ بھی کر رہے ہیں کہ اسے آپ نے خود لکھا ہے یا اسے دائرہ عام یا کسی آزاد ماخذ سے یہاں نقل کر رہے ہیں (تفصیلات کے لیے نعت کائنات:حقوق تصانیف ملاحظہ فرمائیں)۔ براہ کرم اجازت کے بغیر کسی کاپی رائٹ شدہ مواد کو یہاں شائع نہ کریں۔
منسوخ معاونت برائے ترمیم (نئی ونڈو میں کھولیں)

اِس صفحہ پر مستعمل سانچے حسب ذیل ہیں: