Commonly used style rules for markup tables :
There are two different sets of syle rules in use; a set of HTML attributes which are associated with specific element tags, and CSS, (cascading style sheet) , properties.
A short list of each is given for quick reference. These listings are by no means complete, but a link is provided at the bottom of this list for the full CSS properties reference.
HTML Attributes for Tables; use the format;
attribute1=value1 attribute2=value2 attributeN=valueN
Example Values Element* Purpose
align=left** left,right,center,justify T, R, C positions table or text**
valign=top**** top, middle, bottom R, C vertical alignment of TEXT
border=1 0 for none, 1-7 T all borders at once
cellpadding=5px 0 for none, px, pt, em T padding for all cell text
cellspacing=5px 0 for none, px, pt, em T around all cells
height=100px*** px, pt, cm, em, % C cell height
width=200px*** px, pt, cm, em, % T, C table or cell width
colspan="2" number of columns. C joins cells rightwards
rowspan="2" number of rows. C joins cells downwards
* T=Table, R=Rows, C=Cells of any kind
** Align in cells applies horizontal text-alignment.
*** If not specified, the dimensions will adjust to the text.
**** If not specified, the default is middle
CSS Style Rules; use the format;
style="property1:value1; property2:value2; propertyN:valueN;"
Example Values Elements* Purpose
caption-side:top top,right,bottom,left T only some browsers
text-align:right left,right,center,justify T, R, C horizontal alignment of text
vertical-align:top top, middle, bottom C Vertical align text or image
background:yellow name, rgb, hex T, R, C background color
color:blue name, rgb, hex T, R, C text color
font-family:arial font or generic name T, R, C font or font-list
font-size:20pt px, pt, cm, em T, R, C text size
font-style:italic italic, normal T, R, C text style
font-weight:bold bold, normal T, R, C text weight
padding:5px 0 0 0 px, pt, cm, em T, C sequence top,right,bottom,left
margin:0 0 5px 0 px, pt, cm, em T sequence top,right,bottom,left
border:2px solid red* thickness style color T, C border on all four sides
border-collapse: separate or collapse T cellspacing or not
border-spacing: px, pt, cm, em T cellspacing when separate
table-layout:fixed auto or fixed T expands with text or not
width:400px px, pt, cm, em % T, C sets table or cell width
height:200px px, pt, cm, em % T, C sets table or cell height
line-height:2em px, pt, cm, em T, R, C height between text lines
letter-spacing:5px px, pt, cm, em T, R, C space between text characters
word-spacing:10px px, pt, cm, em T, R, C space between words of text
white-space:pre-wrap T long line text wrapping,(soon)
* Separate border properties also exist; border-top,border-right,border-bottom, and border-left.
** T=Table, R=Rows, C=Cells of any kind
Style Expression Spacing Rules for WIKITEXT
Main Points to Avoid
- Line breaks are not permitted within style expressions.
- Spaces are not permitted immediately before colons and semi-colons.
These have Latitude
- Space between the various table symbols and the word style is OK.
- Space around any equals symbol is OK.
- Space between the style rules and their outside parentheses is OK.
- Spaces after colons and semi-colons are OK.
- A semi-colon can be placed immediately after the last style rule.
In addition
- Compound values like '2px solid black' must be space-separated.
- Legacy styles must be separated from CSS style expressions with space.
- HTML element spacing is itself tolerant.
- Wikitext tables can be indented for clarity.
Combining the two style rule methods:
It is possible to mix the attributes with CSS styles provided that they keep to their own local formats.
That is to say; nothing with an equals sign between the quotes, and no CSS rules outside
of them. Note that the Wiki apostrophe codes and various HTML codes can still be used for cell and other text. An example of mixed styles is shown below.
{| border=1 width=300px style="background:lightyellow;color:maroon;"
| height=100px| ''First'' cell
| style="background:black;color:white;" width=200px align=center|''Second'' cell
|} ;
Refer to CSS Reference List for more detailed descriptions of properties and values. |