2012-07-10 75 views
0

問題:我的表格代碼在mediawiki的100%時間內未正確顯示。看起來好像它不正確地從它們所在的「父」表中「繼承」某些顏色。我希望我可以簡單地轉換CSS編碼以使其正常工作,但迄今爲止我還沒有運氣。Mediawiki 1.18 CSS表類。錯誤?

  1. 首先,我將提供mediawiki:common.css代碼。
  2. 其次,我將提供一個展示錯誤的wiki頁面的截圖。
  3. 第三,我將提供屏幕截圖中顯示的頁面的wiki語法。

    h1 {font-variant:small-caps; font-size:200%; font-weight:bold; white-space:nowrap;} 
    h2 {font-variant:small-caps; font-size:175%; font-weight:bold; white-space:nowrap;} 
    h3 {font-size:150%; font-weight:bold; white-space:nowrap;} 
    h4 {font-size:125%; font-weight:bold; white-space:nowrap;} 
    h5 {font-size:112%; font-weight:bold; white-space:nowrap;} 
    h6 {font-size:100%; font-weight:bold; white-space:nowrap;} 
    #bodyContent h1, #bodyContent h2 {margin-bottom: 0.1em;} 
    
    
    table.Default {background:white; color:white; border:1px solid gray;} 
    table.Default th {background:gray;} 
    table.Default td {color:black; border:1px solid lightgray;} 
    table.Default ul {list-style-image:none; list-style-type:square;} 
    table.Default a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Default a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Default a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.Default a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    
    table.Default2 {background:white; color:white; border:1px solid gray;} 
    table.Default2 th {background:gray;} 
    table.Default2 td {color:black; border:1px solid lightgray; padding:5px;} 
    table.Default2 ul {list-style-image:none; list-style-type:square;} 
    table.Default2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Default2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Default2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.Default2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    
    
    table.ProductsAndServices {background:rgb(100,0,0); color:white; border:1px solid rgb(50,0,0);} 
    table.ProductsAndServices th {background:rgb(50,0,0);} 
    table.ProductsAndServices td {border:1px solid rgb(50,0,0);} 
    table.ProductsAndServices ul {list-style-image:none; list-style-type:square;} 
    table.ProductsAndServices a:link {color:rgb(255,100,100); text-decoration:none;} 
    table.ProductsAndServices a:visited {color:rgb(255,100,100); text-decoration:none;} 
    table.ProductsAndServices a:hover {color:rgb(255,200,200); text-decoration:none;} 
    table.ProductsAndServices a:active {color:rgb(255,100,100); text-decoration:none;} 
    table.ProductsAndServices th a:link {color:white; text-decoration:none;} 
    table.ProductsAndServices th a:visited {color:white; text-decoration:none;} 
    table.ProductsAndServices th a:hover {color:rgb(255,200,200); text-decoration:none;} 
    table.ProductsAndServices th a:active {color:white; text-decoration:none;} 
    
    table.ProductsAndServices2 {background:rgb(200,0,0); color:white; border:1px solid rgb(50,0,0); border-spacing:1px;} 
    table.ProductsAndServices2 th {background:rgb(175,0,0); white-space:nowrap;} 
    table.ProductsAndServices2 td {background:rgb(255,245,245); color:black; border:1px solid rgb(50,0,0); padding:5px;} 
    table.ProductsAndServices2 ul {color:black; list-style-image:none; list-style-type:square;} 
    table.ProductsAndServices2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.ProductsAndServices2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.ProductsAndServices2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.ProductsAndServices2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    table.ProductsAndServices2 th a:link {color:white; text-decoration:none;} 
    table.ProductsAndServices2 th a:visited {color:white; text-decoration:none;} 
    table.ProductsAndServices2 th a:hover {color:rgb(255,200,200); text-decoration:none;} 
    table.ProductsAndServices2 th a:active {color:white; text-decoration:none;} 
    
    
    table.Tools {background:rgb(225,125,0); color:white; border:1px solid rgb(200,100,0);} 
    table.Tools th {background:rgb(200,100,0);} 
    table.Tools td {border:1px solid rgb(200,100,0);} 
    table.Tools ul {list-style-image:none; list-style-type:square;} 
    table.Tools a:link {color:rgb(255,200,150); text-decoration:none;} 
    table.Tools a:visited {color:rgb(255,200,150); text-decoration:none;} 
    table.Tools a:hover {color:rgb(255,225,200); text-decoration:none;} 
    table.Tools a:active {color:rgb(255,200,150); text-decoration:none;} 
    table.Tools th a:link {color:white; text-decoration:none;} 
    table.Tools th a:visited {color:white; text-decoration:none;} 
    table.Tools th a:hover {color:rgb(255,225,200); text-decoration:none;} 
    table.Tools th a:active {color:white; text-decoration:none;} 
    
    table.Tools2 {background:rgb(255,175,0); color:white; border:1px solid rgb(200,100,0); border-spacing:1px;} 
    table.Tools2 th {background:rgb(225,150,0); white-space:nowrap;} 
    table.Tools2 td {background:rgb(255,245,225); color:black; border:1px solid rgb(200,100,0); padding:5px;} 
    table.Tools2 ul {color:black; list-style-image:none; list-style-type:square;} 
    table.Tools2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Tools2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Tools2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.Tools2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Tools2 th a:link {color:white; text-decoration:none;} 
    table.Tools2 th a:visited {color:white; text-decoration:none;} 
    table.Tools2 th a:hover {color:rgb(255,225,200); text-decoration:none;} 
    table.Tools2 th a:active {color:white; text-decoration:none;} 
    
    
    table.Email {background:rgb(175,175,0); color:white; border:1px solid rgb(150,150,0);} 
    table.Email th {background:rgb(150,150,0);} 
    table.Email td {border:1px solid rgb(150,150,0);} 
    table.Email ul {list-style-image:none; list-style-type:square;} 
    table.Email a:link {color:rgb(255,255,100); text-decoration:none;} 
    table.Email a:visited {color:rgb(255,255,100); text-decoration:none;} 
    table.Email a:hover {color:rgb(255,255,200); text-decoration:none;} 
    table.Email a:active {color:rgb(255,255,100); text-decoration:none;} 
    table.Email th a:link {color:white; text-decoration:none;} 
    table.Email th a:visited {color:white; text-decoration:none;} 
    table.Email th a:hover {color:rgb(255,255,200); text-decoration:none;} 
    table.Email th a:active {color:white; text-decoration:none;} 
    
    table.Email2 {background:rgb(225,255,0); color:white; border:1px solid rgb(150,150,0); border-spacing:1px;} 
    table.Email2 th {background:rgb(200,200,0); white-space:nowrap;} 
    table.Email2 td {background:rgb(255,255,225); color:black; border:1px solid rgb(150,150,0); padding:5px;} 
    table.Email2 ul {color:black; list-style-image:none; list-style-type:square;} 
    table.Email2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Email2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Email2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.Email2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Email2 th a:link {color:white; text-decoration:none;} 
    table.Email2 th a:visited {color:white; text-decoration:none;} 
    table.Email2 th a:hover {color:rgb(255,255,200); text-decoration:none;} 
    table.Email2 th a:active {color:white; text-decoration:none;} 
    
    
    table.DomainNameSystem {background:rgb(0,100,0); color:white; border:1px solid rgb(0,50,0);} 
    table.DomainNameSystem th {background:rgb(0,50,0);} 
    table.DomainNameSystem td {border:1px solid rgb(0,50,0);} 
    table.DomainNameSystem ul {list-style-image:none; list-style-type:square;} 
    table.DomainNameSystem a:link {color:rgb(100,255,100); text-decoration:none;} 
    table.DomainNameSystem a:visited {color:rgb(100,255,100); text-decoration:none;} 
    table.DomainNameSystem a:hover {color:rgb(200,255,200); text-decoration:none;} 
    table.DomainNameSystem a:active {color:rgb(100,255,100); text-decoration:none;} 
    table.DomainNameSystem th a:link {color:white; text-decoration:none;} 
    table.DomainNameSystem th a:visited {color:white; text-decoration:none;} 
    table.DomainNameSystem th a:hover {color:rgb(200,255,200); text-decoration:none;} 
    table.DomainNameSystem th a:active {color:white; text-decoration:none;} 
    
    table.DomainNameSystem2 {background:rgb(0,200,0); color:white; border:1px solid rgb(0,50,0); border-spacing:1px;} 
    table.DomainNameSystem2 th {background:rgb(0,150,0); white-space:nowrap;} 
    table.DomainNameSystem2 td {background:rgb(235,255,235); color:black; border:1px solid rgb(0,50,0); padding:5px;} 
    table.DomainNameSystem2 ul {color:black; list-style-image:none; list-style-type:square;} 
    table.DomainNameSystem2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.DomainNameSystem2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.DomainNameSystem2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.DomainNameSystem2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    table.DomainNameSystem2 th a:link {color:white; text-decoration:none;} 
    table.DomainNameSystem2 th a:visited {color:white; text-decoration:none;} 
    table.DomainNameSystem2 th a:hover {color:rgb(200,255,200); text-decoration:none;} 
    table.DomainNameSystem2 th a:active {color:white; text-decoration:none;} 
    
    
    table.Policies {background:rgb(0,0,150); color:white; border:1px solid rgb(0,0,100);} 
    table.Policies th {background:rgb(0,0,50);} 
    table.Policies td {border:1px solid rgb(0,0,100);} 
    table.Policies ul {list-style-image:none; list-style-type:square;} 
    table.Policies a:link {color:rgb(100,100,255); text-decoration:none;} 
    table.Policies a:visited {color:rgb(100,100,255); text-decoration:none;} 
    table.Policies a:hover {color:rgb(200,200,255); text-decoration:none;} 
    table.Policies a:active {color:rgb(100,100,255); text-decoration:none;} 
    table.Policies th a:link {color:white; text-decoration:none;} 
    table.Policies th a:visited {color:white; text-decoration:none;} 
    table.Policies th a:hover {color:rgb(200,200,255); text-decoration:none;} 
    table.Policies th a:active {color:white; text-decoration:none;} 
    
    table.Policies2 {background:rgb(0,0,255); color:white; border:1px solid rgb(0,0,100); border-spacing:1px;} 
    table.Policies2 th {background:rgb(0,0,200); white-space:nowrap;} 
    table.Policies2 td {background:rgb(235,235,255); color:black; border:1px solid rgb(0,0,100); padding:5px;} 
    table.Policies2 ul {color:black; list-style-image:none; list-style-type:square;} 
    table.Policies2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Policies2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Policies2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.Policies2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Policies2 th a:link {color:white; text-decoration:none;} 
    table.Policies2 th a:visited {color:white; text-decoration:none;} 
    table.Policies2 th a:hover {color:rgb(200,200,255); text-decoration:none;} 
    table.Policies2 th a:active {color:white; text-decoration:none;} 
    
    
    table.Training {background:rgb(100,0,100); color:white; border:1px solid rgb(50,0,50);} 
    table.Training th {background:rgb(50,0,50);} 
    table.Training td {border:1px solid rgb(50,0,50);} 
    table.Training ul {list-style-image:none; list-style-type:square;} 
    table.Training a:link {color:rgb(255,100,255); text-decoration:none;} 
    table.Training a:visited {color:rgb(255,100,255); text-decoration:none;} 
    table.Training a:hover {color:rgb(255,200,255); text-decoration:none;} 
    table.Training a:active {color:rgb(255,100,255); text-decoration:none;} 
    table.Training th a:link {color:white; text-decoration:none;} 
    table.Training th a:visited {color:white; text-decoration:none;} 
    table.Training th a:hover {color:rgb(255,200,255); text-decoration:none;} 
    table.Training th a:active {color:white; text-decoration:none;} 
    
    table.Training2 {background:rgb(175,0,175); color:white; border:1px solid rgb(50,0,50); border-spacing:1px;} 
    table.Training2 th {background:rgb(125,0,125); white-space:nowrap;} 
    table.Training2 td {background:rgb(255,235,255); color:black; border:1px solid rgb(50,0,50); padding:5px;} 
    table.Training2 ul {color:black; list-style-image:none; list-style-type:square;} 
    table.Training2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Training2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Training2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.Training2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Training2 th a:link {color:white; text-decoration:none;} 
    table.Training2 th a:visited {color:white; text-decoration:none;} 
    table.Training2 th a:hover {color:rgb(255,200,255); text-decoration:none;} 
    table.Training2 th a:active {color:white; text-decoration:none;} 
    
    
    table.WebsiteBuilders {background:rgb(75,50,0); color:white; border:1px solid rgb(25,0,0);} 
    table.WebsiteBuilders th {background:rgb(25,0,0);} 
    table.WebsiteBuilders td {border:1px solid rgb(50,25,0);} 
    table.WebsiteBuilders ul {list-style-image:none; list-style-type:square;} 
    table.WebsiteBuilders a:link {color:rgb(250,225,100); text-decoration:none;} 
    table.WebsiteBuilders a:visited {color:rgb(250,225,100); text-decoration:none;} 
    table.WebsiteBuilders a:hover {color:rgb(255,250,200); text-decoration:none;} 
    table.WebsiteBuilders a:active {color:rgb(250,225,100); text-decoration:none;} 
    table.WebsiteBuilders th a:link {color:white; text-decoration:none;} 
    table.WebsiteBuilders th a:visited {color:white; text-decoration:none;} 
    table.WebsiteBuilders th a:hover {color:rgb(255,250,200); text-decoration:none;} 
    table.WebsiteBuilders th a:active {color:white; text-decoration:none;} 
    
    table.WebsiteBuilders2 {background:rgb(175,125,0); color:white; border:1px solid rgb(25,0,0); border-spacing:1px;} 
    table.WebsiteBuilders2 th {background:rgb(125,75,0); white-space:nowrap;} 
    table.WebsiteBuilders2 td {background:rgb(255,240,225); color:black; border:1px solid rgb(25,0,0); padding:5px;} 
    table.WebsiteBuilders2 ul {color:black; list-style-image:none; list-style-type:square;} 
    table.WebsiteBuilders2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.WebsiteBuilders2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.WebsiteBuilders2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.WebsiteBuilders2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    table.WebsiteBuilders2 th a:link {color:white; text-decoration:none;} 
    table.WebsiteBuilders2 th a:visited {color:white; text-decoration:none;} 
    table.WebsiteBuilders2 th a:hover {color:rgb(255,250,200); text-decoration:none;} 
    table.WebsiteBuilders2 th a:active {color:white; text-decoration:none;} 
    
    
    table.Troubleshooting {background:rgb(50,50,50); color:white; border:1px solid rgb(0,0,0);} 
    table.Troubleshooting th {background:rgb(0,0,0);} 
    table.Troubleshooting td {border:1px solid rgb(0,0,0);} 
    table.Troubleshooting ul {list-style-image:none; list-style-type:square;} 
    table.Troubleshooting a:link {color:rgb(175,175,175); text-decoration:none;} 
    table.Troubleshooting a:visited {color:rgb(175,175,175); text-decoration:none;} 
    table.Troubleshooting a:hover {color:rgb(255,255,255); text-decoration:none;} 
    table.Troubleshooting a:active {color:rgb(175,175,175); text-decoration:none;} 
    table.Troubleshooting th a:link {color:white; text-decoration:none;} 
    table.Troubleshooting th a:visited {color:white; text-decoration:none;} 
    table.Troubleshooting th a:hover {color:rgb(225,225,225); text-decoration:none;} 
    table.Troubleshooting th a:active {color:white; text-decoration:none;} 
    
    table.Troubleshooting2 {background:rgb(150,150,150); color:white; border:1px solid rgb(0,0,0); border-spacing:1px;} 
    table.Troubleshooting2 th {background:rgb(100,100,100); white-space:nowrap;} 
    table.Troubleshooting2 td {background:rgb(245,245,245); color:black; border:1px solid rgb(0,0,0); padding:5px;} 
    table.Troubleshooting2 ul {color:black; list-style-image:none; list-style-type:square;} 
    table.Troubleshooting2 a:link {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Troubleshooting2 a:visited {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Troubleshooting2 a:hover {color:rgb(153, 204, 204); text-decoration:none;} 
    table.Troubleshooting2 a:active {color:rgb(51, 102, 102); text-decoration:none;} 
    table.Troubleshooting2 th a:link {color:white; text-decoration:none;} 
    table.Troubleshooting2 th a:visited {color:white; text-decoration:none;} 
    table.Troubleshooting2 th a:hover {color:rgb(225,225,225); text-decoration:none;} 
    table.Troubleshooting2 th a:active {color:white; text-decoration:none;} 
    
你的風格

the screenshot http://testrfrost.ipage.com/stackoverflow/mediawiki_css_table_class_bug.JPG

{|width="100%" 
| 
{|class="Default2" width="100%" 
!Default2 Header 
|- 
|Default2 Body 
|- 
| 
{|class="ProductsAndServices2" width="100%" 
!ProductsAndServices2 Header 
|- 
|ProductsAndServices2 Body 
|- 
| 
{|class="Tools2" width="100%" 
!Tools2 Header 
|- 
|Tools2 Body 
|- 
| 
{|class="Email2" width="100%" 
!Email2 Header 
|- 
|Email2 Body 
|- 
| 
{|class="DomainNameSystem2" width="100%" 
!DomainNameSystem2 Header 
|- 
|DomainNameSystem2 Body 
|- 
| 
{|class="Policies2" width="100%" 
!Policies2 Header 
|- 
|Policies2 Body 
|- 
| 
{|class="Training2" width="100%" 
!Training2 Header 
|- 
|Training2 Body 
|- 
| 
{|class="WebsiteBuilders2" width="100%" 
!WebsiteBuilders2 Header 
|- 
|WebsiteBuilders2 Body 
|- 
| 
{|class="Troubleshooting2" width="100%" 
!Troubleshooting2 Header 
|- 
|Troubleshooting2 Body 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
| 
{|class="Troubleshooting2" width="100%" 
!Troubleshooting2 Header 
|- 
|Troubleshooting2 body 
|- 
| 
{|class="WebsiteBuilders2" width="100%" 
!WebsiteBuilders2 Header 
|- 
|WebsiteBuilders2 body 
|- 
| 
{|class="Training2" width="100%" 
!Training2 Header 
|- 
|Training2 body 
|- 
| 
{|class="Policies2" width="100%" 
!Policies2 Header 
|- 
|Policies2 body 
|- 
| 
{|class="DomainNameSystem2" width="100%" 
!DomainNameSystem2 Header 
|- 
|DomainNameSystem2 body 
|- 
| 
{|class="Email2" width="100%" 
!Email2 Header 
|- 
|Email2 body 
|- 
| 
{|class="Tools2" width="100%" 
!Tools2 Header 
|- 
|Tools2 body 
|- 
| 
{|class="ProductsAndServices2" width="100%" 
!ProductsAndServices2 Header 
|- 
|ProductsAndServices2 body 
|- 
| 
{|class="Default2" width="100%" 
!Default2 Header 
|- 
|Default2 body 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|- 
| 
{|class="Default" width="100%" 
!Default Header 
|- 
|Default body 
|- 
| 
{|class="ProductsAndServices" width="100%" 
!ProductsAndServices Header 
|- 
|ProductsAndServices body 
|- 
| 
{|class="Tools" width="100%" 
!Tools Header 
|- 
|Tools body 
|- 
| 
{|class="Email" width="100%" 
!Email Header 
|- 
|Email body 
|- 
| 
{|class="DomainNameSystem" width="100%" 
!DomainNameSystem Header 
|- 
|DomainNameSystem body 
|- 
| 
{|class="Policies" width="100%" 
!Policies Header 
|- 
|Policies body 
|- 
| 
{|class="Training" width="100%" 
!Training Header 
|- 
|Training body 
|- 
| 
{|class="WebsiteBuilders" width="100%" 
!WebsiteBuilders Header 
|- 
|WebsiteBuilders body 
|- 
| 
{|class="Troubleshooting" width="100%" 
!Troubleshooting Header 
|- 
|Troubleshooting body 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
| 
{|class="Troubleshooting" width="100%" 
!Troubleshooting Header 
|- 
|Troubleshooting body 
|- 
| 
{|class="WebsiteBuilders" width="100%" 
!WebsiteBuilders Header 
|- 
|WebsiteBuilders body 
|- 
| 
{|class="Training" width="100%" 
!Training Header 
|- 
|Training body 
|- 
| 
{|class="Policies" width="100%" 
!Policies Header 
|- 
|Policies body 
|- 
| 
{|class="DomainNameSystem" width="100%" 
!DomainNameSystem Header 
|- 
|DomainNameSystem body 
|- 
| 
{|class="Email" width="100%" 
!Email Header 
|- 
|Email body 
|- 
| 
{|class="Tools" width="100%" 
!Tools Header 
|- 
|Tools body 
|- 
| 
{|class="ProductsAndServices" width="100%" 
!ProductsAndServices Header 
|- 
|ProductsAndServices body 
|- 
| 
{|class="Default" width="100%" 
!Default Header 
|- 
|Default body 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 
|} 


{|width="100%" 
| 
{|class="Default2" width="100%" 
!Default2 Header 
|- 
|Default2 Body 
|} 
| 
{|class="ProductsAndServices2" width="100%" 
!ProductsAndServices2 Header 
|- 
|ProductsAndServices2 Body 
|} 
| 
{|class="Tools2" width="100%" 
!Tools2 Header 
|- 
|Tools2 Body 
|} 
|- 
| 
{|class="Email2" width="100%" 
!Email2 Header 
|- 
|Email2 Body 
|} 
| 
{|class="DomainNameSystem2" width="100%" 
!DomainNameSystem2 Header 
|- 
|DomainNameSystem2 Body 
|} 
| 
{|class="Policies2" width="100%" 
!Policies2 Header 
|- 
|Policies2 Body 
|} 
|- 
| 
{|class="Training2" width="100%" 
!Training2 Header 
|- 
|Training2 Body 
|} 
| 
{|class="WebsiteBuilders2" width="100%" 
!WebsiteBuilders2 Header 
|- 
|WebsiteBuilders2 Body 
|} 
| 
{|class="Troubleshooting2" width="100%" 
!Troubleshooting2 Header 
|- 
|Troubleshooting2 Body 
|} 
|} 


{|width="100%" 
| 
{|class="Default" width="100%" 
!Default Header 
|- 
|Default Body 
|} 
| 
{|class="ProductsAndServices" width="100%" 
!ProductsAndServices Header 
|- 
|ProductsAndServices Body 
|} 
| 
{|class="Tools" width="100%" 
!Tools Header 
|- 
|Tools Body 
|} 
|- 
| 
{|class="Email" width="100%" 
!Email Header 
|- 
|Email Body 
|} 
| 
{|class="DomainNameSystem" width="100%" 
!DomainNameSystem Header 
|- 
|DomainNameSystem Body 
|} 
| 
{|class="Policies" width="100%" 
!Policies Header 
|- 
|Policies Body 
|} 
|- 
| 
{|class="Training" width="100%" 
!Training Header 
|- 
|Training Body 
|} 
| 
{|class="WebsiteBuilders" width="100%" 
!WebsiteBuilders Header 
|- 
|WebsiteBuilders Body 
|} 
| 
{|class="Troubleshooting" width="100%" 
!Troubleshooting Header 
|- 
|Troubleshooting Body 
|} 
|} 
+0

你能不能結合這些選擇?幾乎所有這些都包含相同的屬性。 – Bergi 2012-07-10 22:16:24

+0

順便說一句,css類通常是較低(或駝峯)的情況像ordinaray變量。截圖在PNG格式中會更好。 – Bergi 2012-07-10 22:17:18

+0

我可以問你是否可以看到該表/子表的CSS值從哪裏繼承?在谷歌瀏覽器中,我可以右鍵單擊並選擇「檢查元素」。它會告訴我在哪裏加載CSS屬性以及哪一行。 Firefox有一個類似的功能,我認爲。 – 2012-07-10 22:15:10

回答

1

所有正在使用的後代選擇,而不是子選擇。所以,嵌套表將會和它們的父表具有相同的樣式。不是因爲繼承,而是因爲它們匹配選擇器。使用子選擇器來代替:

table.Default > tbody > tr > td { color:black; border:1px solid lightgray; } 

這樣,在子表的表格單元格,選擇不再匹配。你可以或者離開選擇,因爲他們,只是另一種定義,即覆蓋以前的選擇更強的選擇:

table.Default table td { border: 0px none; } 

我不打算花時間通過所有的CSS和標記去,所以我猜在這一些。如果您的問題不是子表正在選擇父表樣式,而是子表沒有選取爲其定義的樣式,則需要使選擇器更加強大。例如,如果您有以下樣式定義:

table.foo td { background-color: #ccc; } 
table.bar td { background-color: #ff0; } 

有了這個標記:

<table class="bar"> 
    <tbody> 
     <tr> 
      <td> 
       <table class="foo"> 
        <tbody> 
         <tr> 
          <td>Why am I yellow, and not gray?!</td> 
         </tr> 
        </tbody> 
       </table> 
      </td> 
     </tr> 
    </tbody> 
</table> 

文字是黃色的,而不是灰色:http://jsfiddle.net/gilly3/gzRX6/

爲什麼?因爲table.bar td是更強的選擇器。爲什麼?當兩個選擇器在其他方面相同時,稍後出現在文檔中的是較強的選擇器。您的解決方案可能與在文檔中稍後移動子表樣式一樣簡單。但是,倒不如通過增加tr到混合,使他們多一點顯然更強,如:

table.foo tr td { background-color: #ccc; } 
table.bar td { background-color: #ff0; } 

http://jsfiddle.net/gilly3/gzRX6/1/

+0

孩子選擇器似乎不適用於mediawiki 1.18。 另外,我需要表格是關於哪個表格可以放在裏面的動態表格。後面提供的建議不適用於將表格彼此放置在一起的動態順序。 – 2012-07-12 16:50:50

+0

@Matt - 兒童選擇器*應該*工作。確保您在選擇器中指定了正確的元素。檢查生成的HTML(在瀏覽器中點擊f12)以確保。如果您嘗試設置''元素,則很可能它們包含在「」而不是「」之內。 – gilly3 2012-07-12 17:00:19

+0

@MattFrost - 不,不是''。我剛剛去測試它......你的wiki標記產生''。並使用兒童選擇器的作品。例如:'table.Default> tbody> tr> th'和'table.Default> tbody> tr> td'。當我改變選擇器是這樣的,我得到這個:http://i.imgur.com/R0zWK.png – gilly3 2012-07-12 21:41:28