Css 如何更改reStructuredText中表格单元格的背景色?

Css 如何更改reStructuredText中表格单元格的背景色?,css,restructuredtext,Css,Restructuredtext,接下来,我可以在表格中设置文本的背景,如下所示: .. role:: gbg .. raw:: html <style> .gbg {background-color:#00ff00;} </style> +-------+----------------+-------+---------+-------+---------+ | UTC+1 | (d-s) | UTC-6 | (zo) | UTC-7 | (za

接下来,我可以在表格中设置文本的背景,如下所示:

.. role:: gbg

.. raw:: html

   <style>
      .gbg {background-color:#00ff00;} 
   </style>

+-------+----------------+-------+---------+-------+---------+
| UTC+1 | (d-s)          | UTC-6 | (zo)    | UTC-7 | (za)    |
+=======+================+=======+=========+=======+=========+
| 15:00 | :gbg:`avail`   |  8:00 |         |  7:00 |         |
+-------+                +-------+---------+-------+         +
| 15:30 |                |  8:30 |         |  7:30 |         |
+-------+----------------+-------+---------+-------+---------+
。。角色::gbg
.. 原始::html
.gbg{背景色:#00ff00;}
+-------+----------------+-------+---------+-------+---------+
|UTC+1 |(d-s)| UTC-6 |(zo)| UTC-7 |(za)|
+=======+================+=======+=========+=======+=========+
|15:00:gbg:'avail`| 8:00 | | 7:00 ||
+-------+                +-------+---------+-------+         +
| 15:30 |                |  8:30 |         |  7:30 |         |
+-------+----------------+-------+---------+-------+---------+

这会导致单词“avail”在字母后面有一个绿色背景,但我如何才能使整个单元格有一个彩色背景,而不是这些字母后面的部分背景呢?

用javascript将其混在一起:

.. role:: gbg

.. raw:: html

   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
   <script>
     $(document).ready(function() {
       $('.gbg').parent().addClass('gbg-parent');
     });
   </script>
   <style>
      .gbg-parent {background-color:#00ff00;}
   </style>

+-------+----------------+-------+---------+-------+---------+
| UTC+1 | (d-s)          | UTC-6 | (zo)    | UTC-7 | (za)    |
+=======+================+=======+=========+=======+=========+
| 15:00 | :gbg:`avail`   |  8:00 |         |  7:00 |         |
+-------+                +-------+---------+-------+         +
| 15:30 |                |  8:30 |         |  7:30 |         |
+-------+----------------+-------+---------+-------+---------+
。。角色::gbg
.. 原始::html
$(文档).ready(函数(){
$('.gbg').parent().addClass('gbg-parent');
});
.gbg父项{背景色:#00ff00;}
+-------+----------------+-------+---------+-------+---------+
|UTC+1 |(d-s)| UTC-6 |(zo)| UTC-7 |(za)|
+=======+================+=======+=========+=======+=========+
|15:00:gbg:'avail`| 8:00 | | 7:00 ||
+-------+                +-------+---------+-------+         +
| 15:30 |                |  8:30 |         |  7:30 |         |
+-------+----------------+-------+---------+-------+---------+
休息:

.. table::
   :class: rows

   +-------+----------------+-------+---------+-------+---------+
   | UTC+1 | (d-s)          | UTC-6 | (zo)    | UTC-7 | (za)    |
   +=======+================+=======+=========+=======+=========+
   | 15:00 | avail          |  8:00 |         |  7:00 |         |
   +-------+                +-------+---------+-------+         +
   | 15:30 |                |  8:30 |         |  7:30 |         |
   +-------+----------------+-------+---------+-------+---------+
CSS:

table.rows th {
    background-color: #ede;
    border-style: solid solid solid solid;
    border-width: 0px 0px 0px 0px;
    border-color: #AAAAAA;
    text-align: center;
}
table.rows td {
    border-style: solid solid solid solid;
    border-width: 0px 0px 0px 0px;
    border-color: #AAAAAA;
}

table.rows tr {
    border-style: solid solid solid solid;
    border-width: 0px 0px 0px 0px;
    border-color: #AAAAAA;
}

table.rows tr:nth-child(even) {
    background-color: #F3F3FF;
}
table.rows tr:nth-child(odd) {
    background-color: #FFFFEE;
}