• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Cards/sandbox

  • Template
  • Talk
  • Language
  • Watch
  • Edit
< Template:Cards
This is the template sandbox page for Template:Cards (diff).
See also the companion subpage for test cases.
Template documentation[view] [edit] [history] [purge]
CSSThis template uses TemplateStyles:
  • Template:Cards/sandbox/styles.css

Contents

  • 1 Basic
    • 1.1 Rank
      • 1.1.1 52-card deck
      • 1.1.2 56-card deck
      • 1.1.3 Joker
      • 1.1.4 ? card
      • 1.1.5 Customized card
    • 1.2 Suit
    • 1.3 Compound use
    • 1.4 Other note
  • 2 Advanced usage
    • 2.1 Description of all parameters
    • 2.2 HTML, class names and CSS
    • 2.3 Developers' links
  • 3 See also
  • 4 Notes

Basic

edit

Rank

edit

52-card deck

edit

Card ranks from Standard 52-card deck:

  • {{Cards|A}}, {{Cards|K}}, {{Cards|Q}}, {{Cards|J}} = A, K, Q, J
  • {{Cards|10}} or {{Cards|T}} = 10
  • {{Cards|9}} - {{Cards|2}} = 9 - 2

56-card deck

edit

Card ranks from 56-card deck[1]:

  • {{Cards|kn}} or {{Cards|n}} = Kn (Knight, standard 56-card deck)
  • {{Cards|1}} = 1 (standard 56-card deck)
  • {{Cards|11}} = 11 (nonstandard 56-card deck)

Joker

edit
  • {{Cards|Jkr}} = Jkr

You may use "r" (red) or "b" (black) suit:

  • {{Cards|Jkrr}} = Jkr(red)
  • {{Cards|Jkrb}} = Jkr(black)

Or maybe use the parameters "rank_name" and "suit_name" (details see below, the "Advanced usage" section) to get a full name:

  • {{Cards|Jkrr|rank_name=full|suit_name=full}} = Joker (red)
  • {{Cards|Jkrb|rank_name=full|suit_name=full}} = Joker (black)

? card

edit

Symbols that indicate any or unknown card rank:

  • {{Cards|?}} = ?
  • {{Cards|x}} = X

Customized card

edit

Actually any string will be allowed to be shown as a "card", e.g.: {{Cards|Cd}} = C♦, {{Cards|Vs}} = V♠, {{Cards|€h}} = €♥, {{Cards|勾c}} = 勾♣

If one of "s", "h", "d", "c", "r", "b" in lower or upper case, and ♠, ♥, ♦, ♣ is at the end, it will be thought as a suit. A "&" symbol can be used to escape, as: {{Cards|R&}} = R, {{Cards|Joker&}} = Joker, {{Cards|♥♥&}} = ♥♥

The first letter of "a", "k", "q", "kn", "j", "jkr" and "x" will be capitalized. To prevent it, put them in a <span></span>: {{Cards|<span>k</span>s}} = k♠

Suit

edit
  • {{Cards|s}} or {{Cards|♠}} = ♠
  • {{Cards|h}} or {{Cards|♥}} = ♥
  • {{Cards|d}} or {{Cards|♦}} = ♦
  • {{Cards|c}} or {{Cards|♣}} = ♣
  • {{Cards|r}} = (red)
  • {{Cards|b}} = (black)

Compound use

edit
  • {{Cards|Ac|Kd|Ts|2h}} or {{Cards|A♣|K♦|10♠|2♥}} = A♣ K♦ 10♠ 2♥
  • Card ranks without suit: {{Cards|A|K|T|2}} = A K 10 2
  • Stand-alone suit symbols: {{Cards|c|d|s|h}} or {{Cards|♣|♦|♠|♥}} = ♣ ♦ ♠ ♥

Other note

edit

Predefined strings: "a", "k", "q", "kn", "j", "jkr", "x", and "s", "h", "d", "c", "r", "b", are case insensitive when parsed.

The number of the basic, non-named parameters (for cards) should be from 1 to 15.

Advanced usage

edit

Description of all parameters

edit
{{Cards
| <!-- first card's rank and/or suit,
as described above in the "Basic" section -->
| <!-- second card --><!--
... 15 max. -->
| separator      = 
| sortable       = <!-- "yes" or anything else -->
| rank_name      = <!-- "full" or anything else -->
| suit_name      = <!-- "full" or "letter" or anything else -->
| hand_style     = 
| spades_color   = 
| hearts_color   = 
| diamonds_color = 
| clubs_color    = 
| boldface       = <!-- "yes" or "no" -->
| card_style     = <!--
| use_image      = -->
}}
Clk
to
sort
Q
K
10
?
1
A
Jkr
2
9
5
11
Kn
J
Clk
to
sort
♣
(black)
♥
(red)
♠
♦
Click
to
sort
10♦
J♥
4♦
J♠
Jkr(black)
J♣
A♠
Jkr(red)
K♠
J♦
J(red)
J
Click to sort
10♦ 10♠
J♥ J♠
4♦ Jkr(black)
Jack of heart, Jack of heart
J♥ Jkr(red)
4♦ 7♠
J♥ K(black)
7♠ 4♦
J♥ Kn♠
J♥
Jack♠ 6
Jack♥ Jack(black)
J♥ J
K♠ A♦
K♠ 3♠

All these parameters are optional.

  • separator: separator that separates every card, default is a non-breaking space (&nbsp;)
  • sortable: may be "yes" or anything else:
    • yes: add a hidden key to indicate the card rank and suit's level to make it sortable in a table; card ranks from highest to lowest: Jkr, A, K, Q, Kn, J, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, then anything else; suits from highest to lowest: ♠, ♥, ♦, ♣, red, black, then those without suit indicated; note that it can only tell first card's rank, then the second card's rank, ..., it may not reflect the hand's actual value when it includes 2 or more cards
    • Anything else (incl. leaving blank or not presenting this parameter): default, not do it
  • rank_name: "full" or anything else:
    • full: full rank name: "Joker", "Ace", "King", "Queen", "Knight", "Jack", "11", "10", "9", ...
    • Anything else (incl. leaving blank or not presenting this parameter): default, normal abbr. rank name: "Jkr", "A", "K", "Q", "Kn", "J", "11", "10", "9", ...
  • suit_name: "full" or "letter" or anything else:
    • full: full suit name with a space before: " of spade", " of heart", " of diamond", " of club", " (red)", " (black)"; if you use a full suit name, usually you may want to make the card rank name full and make the separator a comma and a space (a non-breaking space "&nbsp;" must be used), that'll be: {{Cards|Ac|Kd|10s|2h|separator=,&nbsp;|rank_name=full|suit_name=full}} = Ace of club, King of diamond, 10 of spade, 2 of heart
    • letter: one letter suit name: "s", "h", "d", "c", "r", "b"
    • Anything else (incl. leaving blank or not presenting this parameter): default, normal suit name: "♠", "♥", "♦", "♣", "(red)", "(black)"
  • hand_style: CSS style for the hand <b style="" class="pokerhands"></b>
  • spades_color, hearts_color, diamonds_color, clubs_color: color (CSS color value, like "#FFFFFF" or "white") for cards of every suit; default is 2 black and 2 red; with these parameters, you may make it a 4-color deck: {{Cards|Ac|Kd|10s|2h|diamonds_color=blue|clubs_color=green}} = A♣ K♦ 10♠ 2♥
  • boldface: enables or disables boldface on card font
    • yes: uses bold font to display cards (default setting): A♣ K♦ Q♠ J♥ Jkr
    • no: uses regular font to display cards: A♣ K♦ Q♠ J♥ Jkr
  • card_style: CSS style for every card <span style="" class="playingcards"></span>
  • use_image: (not yet implemented) use images to show the cards

HTML, class names and CSS

edit

The HTML markup produced by this template includes a microformat, it uses rich semantic class names including: "pokerhands", "playingcards", "spades", "hearts", "diamonds", "clubs", "cardranks", "cardsuits", which makes the details parsable by computers.

For example, {{Cards|Ac|10♥|Knd|?|J|s}} generates A♣ 10♥ Kn♦ ? J ♠, whose HTML markup is:

<!-- sortable hidden key, if needed, is inserted before <b /> and is like:
<span data-sort-value="&140&10&100&30&115&20&000&00&110&00&105&40"></span> -->
<b style="" class="pokerhands"><!-- value of 'hand_style', if exists, is added here inside 'style=""' -->
	<span style="color:black;" class="playingcards clubs"><!-- 'black' will changed to 'clubs_color''s value if defined;
'card_style''s value, if exists, is added here inside 'style=""', and after the color value;
same things apply to below ones -->
		<span class="cardranks">A</span><span class="cardsuits">&clubs;</span>
	</span>&nbsp;<!-- &nbsp; will be replaced by user defined 'separator' if there is one;
same thing applys to below ones -->
	<span style="color:red;" class="playingcards hearts">
		<span class="cardranks">10</span><span class="cardsuits">&hearts;</span>
	</span>&nbsp;
	<span style="color:red;" class="playingcards diamonds">
		<span class="cardranks">Kn</span><span class="cardsuits">&diams;</span>
	</span>&nbsp;
	<span style="" class="playingcards"><!-- 'card_style''s value, if exists, is added here inside 'style=""';
same thing applys to below one -->
		<span class="cardranks">?</span>
	</span>&nbsp;
	<span style="" class="playingcards">
		<span class="cardranks">J</span>
	</span>&nbsp;
	<span style="color:black;" class="playingcards spades">
		<span class="cardsuits">&spades;</span>
	</span>
</b>

Template for playing cards, will automatically color the suits with the standard red/black. To see a typical 4-color deck, copy the following into your user style sheet (Special:MyPage/common.css for the common CSS):

/* Standard four-color deck */
.diamonds { color: blue !important }
.clubs { color: green !important }

Developers' links

edit
This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages.
You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here.
  • Template:Cards/core
  • Template:Cards/core2
  • Template:Cards/core3
  • User:Chzz/cards/clubs
  • User:Chzz/cards/diamonds
  • User:Chzz/cards/hearts
  • User:Chzz/cards/spades

See also

edit
  • Template:Card

Notes

edit
  1. ^ containing in each suit a King, Queen, Knight, and Valet (from the French tarot court)
The above documentation is transcluded from Template:Cards/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Cards/sandbox&oldid=1300583329"
Last edited on 15 July 2025, at 05:41

Languages

      This page is not available in other languages.

      Wikipedia
      • Wikimedia Foundation
      • Powered by MediaWiki
      • This page was last edited on 15 July 2025, at 05:41 (UTC).
      • Content is available under CC BY-SA 4.0 unless otherwise noted.
      • Privacy policy
      • About Wikipedia
      • Disclaimers
      • Contact Wikipedia
      • Code of Conduct
      • Developers
      • Statistics
      • Cookie statement
      • Terms of Use
      • Desktop