Difference between revisions of "HTML table formatting"

From Conservapedia
Jump to navigation Jump to search
(done)
(woho!)
Line 55: Line 55:
 
This can also be combined with other elements to change styling. However this element is relatively restricted - as you are unable to efficiently change the color of the border, and alternatively you could present the border as a component of a style variable, however as you can see in the table below - this only works for the outside border. This border argument is presented with 3 sub-components - width, style (hidden, dotted, dashed, solid, double, groove, ridge, inset, outset) and color.<code><nowiki><table style="border: 1px solid blue"></nowiki></code>
 
This can also be combined with other elements to change styling. However this element is relatively restricted - as you are unable to efficiently change the color of the border, and alternatively you could present the border as a component of a style variable, however as you can see in the table below - this only works for the outside border. This border argument is presented with 3 sub-components - width, style (hidden, dotted, dashed, solid, double, groove, ridge, inset, outset) and color.<code><nowiki><table style="border: 1px solid blue"></nowiki></code>
 
<!--For this table DO NOT use any classes - they screw up the tables that are inside of this - I've manually made the table essentially the class -->
 
<!--For this table DO NOT use any classes - they screw up the tables that are inside of this - I've manually made the table essentially the class -->
−
<!--Add you're additions in this style: {{:HTML table formatting/borders1|1=YOU'RE STYLE (i.e. border="1"; style="border:1px solid black" etc. Every 2 add |- -->
+
<!--Add you're additions in this style: {{:HTML table formatting/borders1|1=YOU'RE STYLE (i.e. border="1"; style="border:1px solid black" etc. Every 2 add "{{!}}-"  -->
−
{| style="margin:1em 1em 1em 0; background:#F9F9F9; border:1px; border:1px #AAA solid; border-collapse:collapse"
+
 
−
!colspan="4" style=" border:1px #AAA solid; background:#F2F2F2;"|Various Tables and Borders<sup>[[#Note|[1]]]</sup>
+
{{:HTML table formatting/borders2|1=
−
|-
+
 
−
!style=" border:1px #AAA solid; background:#F2F2F2;" width="40%"|Code
 
−
!style=" border:1px #AAA solid; background:#F2F2F2;" width="10%"|Result
 
−
!style=" border:1px #AAA solid; background:#F2F2F2;" width="40%"|Code
 
−
!style=" border:1px #AAA solid; background:#F2F2F2;" width="10%"|Result
 
−
|-
 
 
{{:HTML table formatting/borders1|1=border='3px'}}
 
{{:HTML table formatting/borders1|1=border='3px'}}
 
{{:HTML table formatting/borders1|1=frame=box rules=all border=2}}
 
{{:HTML table formatting/borders1|1=frame=box rules=all border=2}}
−
|-
+
{{!}}-
 
{{:HTML table formatting/borders1|1=style="border: 1px solid blue"}}
 
{{:HTML table formatting/borders1|1=style="border: 1px solid blue"}}
 
{{:HTML table formatting/borders1|1=style="border-top:1px solid blue; border-bottom: 3px solid maroon; border-right:none; border-left: 1px double black"}}
 
{{:HTML table formatting/borders1|1=style="border-top:1px solid blue; border-bottom: 3px solid maroon; border-right:none; border-left: 1px double black"}}
−
|}</noinclude>
+
 
 +
}}
  
 
=====Note=====
 
=====Note=====
 
<sup>[1]</sup><small>Borders can also more tediously be set for <nowiki><td> and <th></nowiki> tags.</small>
 
<sup>[1]</sup><small>Borders can also more tediously be set for <nowiki><td> and <th></nowiki> tags.</small>
 
[[category:Website Development]]
 
[[category:Website Development]]

Revision as of 19:51, August 23, 2007

HTML table formatting is cumbersome and often perplexing. For instance, to get rid of the hollow or "chiseled" borders between rows and columns, use these codes: frame=box rules=all

Syntax

Standard

Every table starts out with the ordinary tag <table>. This is typically followed by a <tr> tag which signifies the beginning of a new row. This is followed by a <td> tag which stands for "table data" - i.e. every box inside the row. Each td and tr tag must be closed, as must the table tag. (</td></tr></table>)



<-- Each black item is a table data

<-- This blue item is the table row

How that was done:
<table>

<tr> <td style="background:black" ><br/></td> <td style="background:black" ><br/></td> </tr>
<tr> <td "colspan="2"><br/></td> </tr>

Colspan and Rowspan

Every row must have the same number of table datas, occasionally table datas have to span more than one column or row. In this case the tags colspan and/or rowspan are used - where they are set to a number.




<-- This row has three table datas


<-- This row has two. The first uses colspan="2"



<-- This row has three table datas, but one spans two rows because it uses rowspan="2"


<-- This row has only two table datas, because its first is being taken up.

Borders

Border can be done one of two ways. Typically the best way to do borders is having a border variable isolated - as in: <TABLE border='3px'>

This can also be combined with other elements to change styling. However this element is relatively restricted - as you are unable to efficiently change the color of the border, and alternatively you could present the border as a component of a style variable, however as you can see in the table below - this only works for the outside border. This border argument is presented with 3 sub-components - width, style (hidden, dotted, dashed, solid, double, groove, ridge, inset, outset) and color.<table style="border: 1px solid blue">

HTML table formatting/borders2

Note

[1]Borders can also more tediously be set for <td> and <th> tags.