MyCode Table with alternated rows
#1
This is not a simple MyCode because there's a small addition in the global.css file, I'll do a plugin later if it's useful.

The goal: creating tables in MyBB posts with alternate lines design (odd and even).

It requires 4 MyCode and 3 css addition.

--- MyCode ---

Table

Regular Expression :
Code:
\[table\](.*?)\[/table\]
Replacement :
Code:
<table class="clear" cellspacing="0" cellpadding="5"  style="border:0; radius:0;">$1</table>

Table row

Regular Expression :
Code:
\[tr\](.*?)\[/tr\]
Replacement :
Code:
<tr class="trowaltern">$1</tr>

Table head

Regular Expression :
Code:
\[th\](.*?)\[/th\]
Replacement :
Code:
<th class="thead" valign="middle" style="text-align:center; border-radius:0;"><strong>$1</strong></th>

Table data

Regular Expression :
Code:
\[td\](.*?)\[/td\]
Replacement :
Code:
<td valign="top">$1</td>

--- CSS ---
Code:
/* global values for table data */
.trowaltern > td {
    border: 1px solid;
    border-color: #fff #ddd #ddd #fff;
}
/* even row background */
.trowaltern:nth-child(even) { background: #f5f5f5; }
/* odd row background */
.trowaltern:nth-child(odd) { background: #efefef; }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)