• Stars
    star
    192
  • Rank 202,019 (Top 4 %)
  • Language
  • Created over 14 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CSS Playing Cards help you to create simple and semantic playing cards in (X)HTML

CSS Playing Cards

CSS Playing Cards help you to create simple and semantic playing cards in (X)HTML.

Contents

  • cards.css is the main part and provides the styles for the cards
  • cards-ie.css is a tiny fix for IE < 9 to make a simple version work
  • cards-ie9.css is a fix for IE9
  • examples.html provides some example HTML
  • README.md is this file
  • faces/ contains images for the faces

How to use it

Surrounding container

<div class="playingCards [fourColours|faceImages|simpleCards|inText|rotateHand]">
    ...
</div>

There needs to be a surrounding container with the class "playingCards" around all the cards. That container can also have other classes which serve as configuration options:

  • fourColours: Switches the default two colour deck with a four colour deck. (The colours of the German four colour deck will be different.)
  • faceImages: Switches the default dingbat symbols for faces with images. Note: Depending on the size of the card, you might need to adjust the image positioning of the faces in cards.css and the font-size in cards-ie9.css (search for "@change").
  • simpleCards: Switches the default multiple suits to one simple single big suit in the middle.
  • inText: Switches the size to something small enough to fit into normal text and also removes the inner bits.
  • rotateHand: Switches the hand to rotate and fan in a semi circle.

The back of a card

<[element] class="card back">*</[element]>

To make the cards smaller or bigger, just change the font-size in the main "card" class in cards.css (search for "@change").

The front of a card

<[element] class="card rank-[2|3|4|5|6|7|8|9|10|j|q|k|a] [diams|hearts|spades|clubs]">
    <[element] class="rank">[2|3|4|5|6|7|8|9|10|J|Q|K|A]</[element]>
    <[element] class="suit">&[diams|hearts|spades|clubs];</[element]>
</[element]>

Depending on the context, the main card element should either be an a (for selecting single cards), a label (for selecting multiple cards), an abbr (for making a card more accessible with a title), a div or a span (for pure representation or played cards), e.g.

<[a|label|abbr|div|span] class="card rank-a clubs" [href=""] [title=""]>
    <span class="rank">A</span>
    <span class="suit">&clubs;</span>
    [<input type="checkbox" [...] />] <!-- if in label -->
</[a|label|abbr|div|span]>

A joker

<[element] class="card joker [big|little]">
    <[element] class="rank">[+|-]</[element]>
    <[element] class="suit">Joker</[element]>
</[element]>

Different hands

<ul class="[table|hand|deck]">
    <li>
        [<strong>] <!-- if selected -->
            ... card ...
        [</strong>]
    </li>
    ...
</ul>
  • table places the whole cards side by side.
  • hand places them side by side, but lets them overlap, so you will only see a part of each card. If the "rotateHand" option is enabled, you'll see the cards rotated in a semi circle.
  • deck places the cards on top of each other, so that you cannot see single cards but a pack.

Requirements

The CSS is only intended to work in modern browsers (Firefox 3.6+, Opera 10+, Chrome, Safari, IE9). To make a basic version work in IE8, you need the provided cards-ie.css. And IE9 also needs a little fix, as provided in cards-ie9.css.

Credits

More Repositories

1

dokuwiki_template_writr

Bold, minimalist and modern DokuWiki template, converted from the Writr WordPress theme
CSS
50
star
2

dokuwiki_plugin_wrap

Wrap Plugin for DokuWiki: Universal plugin which combines functionalities of many other plugins. Wrap wiki text inside containers (divs or spans) and give them a class (choose from a variety of preset classes), a width and/or a language with its associated text direction.
PHP
41
star
3

dokuwiki_template_starter

The DokuWiki template that gets you started
CSS
33
star
4

dokuwiki_plugin_abc

ABC Plugin for DokuWiki: Displays sheet music (input ABC, output PNG, MIDI and PDF)
PHP
5
star
5

dokuwiki_plugin_purplenumbers

PurpleNumbers Plugin for DokuWiki: Adds "Purple Numbers" (granular IDs) to every block level element.
PHP
5
star
6

dokuwiki_plugin_orgchart

OrgChart plugin for DokuWiki: Create an org chart from a table
JavaScript
4
star
7

dokuwiki_plugin_wikipediasnippet

WikipediaSnippet Plugin for DokuWiki: Includes a snippet from a Wikipedia article.
PHP
4
star
8

dokuwiki_template_doogiestpl

Doogie's Template for DokuWiki
CSS
3
star
9

piecepack-shape-library

Piecepack library for Draw.io
3
star
10

dokuwiki_template_ach

CSS
2
star
11

dokuwiki_plugin_fontface

DokuWiki Plugin to embed fonts (via uploaded fonts or Google Fonts)
PHP
2
star
12

dokuwiki_plugin_editions

DokuWiki plugin to compare several editions of the same text in different versions or languages
PHP
2
star
13

basic.css

Basic styles
1
star
14

dokuwiki_plugin_abc2

ABC Plugin for DokuWiki: Displays sheet music (input ABC, output SVG and MIDI)
JavaScript
1
star
15

dokuwiki_plugin_unformattedcode

DokuWiki plugin: Overwrites the core ''monospace/code'' formatting to prevent text conversions (entities/typography) inside.
PHP
1
star