gpt4 book ai didi

css - 如何更改 reStructuredText 中表格单元格的背景颜色?

转载 作者:行者123 更新时间:2023-11-28 08:38:23 40 4
gpt4 key购买 nike

正在关注 How to use color in text with ReStructured Text (rst2html.py) or how to insert HTML tags without blank lines?我能够在表格中设置文本的背景,如下所示:

.. 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 | |
+-------+----------------+-------+---------+-------+---------+

这导致单词“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 | |
+-------+----------------+-------+---------+-------+---------+

关于css - 如何更改 reStructuredText 中表格单元格的背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7236277/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com