简体   繁体   English

无法在Gitbook上反映CSS for PDF

[英]Could not reflect CSS for PDF on Gitbook

I could change design my Gitbook website with my CSS. 我可以使用CSS更改Gitbook网站的设计。
However, I didn't understand applying CSS to PDF. 但是,我不理解将CSS应用于PDF。

When I used same CSS for PDF as CSS for website, results are not same. 当我将相同的CSS用于CSS与网站CSS时,结果是不一样的。
I thought CSS for PDF does not seem working fine. 我认为CSS for PDF似乎无法正常工作。

I wrote book.json as follows. 我写了book.json如下。

"plugins": ["styles-sass", "image-captions"],
"styles": {
    "website": "styles/website.scss",
    "pdf": "styles/pdf.scss"
}

and pdf.scss is as follows. pdf.scss如下。

.book {
    .book-body {
        .page-wrapper {
            .page-inner {
                section.normal {
                    h1 {
                        text-align: center;
                    }
                }
            }
        }
    }
}

Please tell me about that this operation is correct. 请告诉我该操作是正确的。
Or if you have any sample about pdf.css , please tell me. 或者,如果您有任何有关pdf.css示例,请告诉我。

I solved this problem. 我解决了这个问题。
Gitbook refers /home/<UserName>/.gitbook/versions/2.6.7/theme/assets/ebook/pdf.css in default settings. Gitbook在默认设置中引用/home/<UserName>/.gitbook/versions/2.6.7/theme/assets/ebook/pdf.css
Then, I found .section.toc>h1{text-align:center;} in this file. 然后,我在此文件中找到.section.toc>h1{text-align:center;}
So I wrote style/pdf.scss as follows, and it works fine. 因此,我将style/pdf.scss如下,并且工作正常。

.section {
    &.toc {
        >h1 {
            text-align:right;
        }
    }
}

If above stylesheet is used, table contents title is aligned right. 如果使用上述样式表,则表内容标题将右对齐。
And other style will be set with same way. 其他样式将以相同的方式设置。

Thank you!! 谢谢!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM