LoginSignup
0
0

More than 3 years have passed since last update.

Sphinx、表の一部を装飾する(一部だけスタイルを変えたい)

Last updated at Posted at 2016-05-31

Sphinx & reStructuredText は簡単で便利ですが、あえて複雑なことをしたくなる場合もあります。とくに表の一部だけスタイルを変えたいということは時々あります。

簡単にいうと「.. raw:: html」を使用し、表を div タグで囲み、CSS でその div を ID で指定、その直下のテーブルを指定して修飾します。

.. raw:: html

    <style type="text/css">
        #theTableBlock table tr:nth-child(1) td:nth-child(3)  {
            color: red;
        }
    </style>
    <div id="theTableBlock">

+----+--------+------------+
| No | 品名   | 金額       |
+====+========+============+
| 1  | Orange | -2000      |
+----+--------+------------+

.. raw:: html

    </div>

追記:ツール

 Excel で表のスタイルだけを CSS にして書き出すアドインを作りました。

Excel で、表の修飾を CSS で書き出すアドイン - Qiita

キーワード

rst reStructuredText 表 背景色 色 装飾 スタイル CSS

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0