[Mediawiki-l] properly nesting tables

Frederich, Eric P2173 eric.frederich at siemens.com
Tue Jun 6 21:21:44 UTC 2006


Wow, that worked thanks a lot.  There have been plenty of solutions but this is by far the easiest and most elegant.
So that I understand exactly what is going on...that explicitly says that a table nested inside a wikitable should not have a border?

There is one problem that I have with this solution...
I noticed now that when I nest a wikitable inside of a wikitable that the inner table doesn't have cell borders now and it should.
The solution I am really looking for a way to make a table to look exactly the same whether it is inside of another table or outside by itself.

Here is a table I made and below it I put my common.css

{| class="wikitable"
|-
|
* this is a normal cell in the outer table
| bla || bla
|-
|
'''in this cell is an inner table where each cell has an explicit border'''
{|
|+ Inner Table 1
|-
| style="border: 2px solid red" | 1
| style="border: 2px solid red" | 2
| style="border: 2px solid red" | 3
|-
| style="border: 2px solid red" | 4
| style="border: 2px solid red" | 5
| style="border: 2px solid red" | 6
|-
| style="border: 2px solid red" | 7
| style="border: 2px solid red" | 8
| style="border: 2px solid red" | 9
|}
| bla || bla
|-
|
In this cell is an inner wikitable
which I would think should have a
border on each cell just like the
outer one does.  It doesn't because
we put
<pre>
table.wikitable table td{
  border: none;
}
</pre>
in MediaWiki:Common.css
{| class="wikitable"
|+ Inner Table 2
|-
| 1 || 2 || 3
|-
| 4 || 5 || 6
|-
| 7 || 8 || 9
|}
| bla || bla
|}

Below is my common.css

/* This resolves an issue with CSS not working correctly.  It must be the first entry. */
thisneverworks {
}

table.wikitable, table.prettytable {
 margin: 1em 1em 1em 0;
 background: #f9f9f9;
 border: 1px #aaaaaa solid;
 border-collapse: collapse;
}

table.wikitable th, table.wikitable td, table.prettytable th, table.prettytable td {
 border: 1px #aaaaaa solid;
 padding: 0.2em;
}

table.wikitable th, table.prettytable th {
 background: #f2f2f2;
 text-align: center;
}

table.wikitable caption, table.prettytable caption {
 margin-left: inherit;
 margin-right: inherit;
}

/* the following three lines prevent unwanted borders from showing up in tables that get nested inside of a wikitable */
table.wikitable table td{
  border: none;
}


-----Original Message-----
From: mediawiki-l-bounces at Wikimedia.org [mailto:mediawiki-l-bounces at Wikimedia.org] On Behalf Of Alexis Moinet
Sent: Tuesday, June 06, 2006 12:02 PM
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] properly nesting tables

Frederich, Eric P2173 a écrit :
 > I tried with style="border: 0" and it worked, I will change it to border: none; if that is the preferred way.
 > See my new template below.  Now this leads to a new question.  If I have tons of stuff that I want in a nested table is there 
a way to globally apply the style="border: none" to every cell rather than be having to explicitly set it on every cell as I
 > did below?

you can add this in common.css (it works, I just tested it)

table.wikitable table td{
	border: none;
}


_______________________________________________
MediaWiki-l mailing list
MediaWiki-l at Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l



More information about the MediaWiki-l mailing list