我怎样才能简单地添加一个css文件来更改我闪亮的应用程序的背景颜色 [英] How can I simply add a css file to change the background color for my shiny app
问题描述
我正在从...问我的问题
I'm re-asking my question from...
...将其推广到尚未真正获得CSS的useR.我花了很多时间阅读 http://shiny.rstudio.com/上的rstudio CSS指南.article/css.html ,但仍然没有点击.我了解几件事,尽管我认为这意味着我在那里90%.
...to generalize it for useRs that don't really get css yet. I've spent time reading over the rstudio css guide at http://shiny.rstudio.com/articles/css.html but it still doesn't click. I understand a couple things though that I think means I'm 90% there.
- 必须在ui.r中以及从fluidPage或navbarPage函数中的主题参数链接css文件.
- 添加非常稀疏的CSS文件以添加背景色会破坏现有的CSS.
所以,我的问题是,在 http://shiny.rstudio.com/gallery/faithful.html .
So, my question is what is the simplest implementation of css to change the background color of the example histogram app at the shiny gallery at http://shiny.rstudio.com/gallery/faithful.html.
我认为这个问题的答案将对一些像我这样的CSS新手来说很有帮助的应用程序开发人员有所帮助.
I think the answer to this question would help along some shiny app developers that are new to css like myself.
推荐答案
来自发光文章:
设置了Shiny应用程序目录后,您有两种选择可以链接到CSS文件(您的应用程序只有在使用CSS时才会使用CSS).您可以:
Once your Shiny app directory is set, you have two choices to link to your CSS file (your app won’t use the CSS until you do). You can:
- 将fluidPage的主题参数设置为文档的名称
- 或将文件包含在标签对象中.
但最简单的方法实际上似乎是使用函数 includeCSS():
But the simplest way really seems to use the function includeCSS():
includeCSS(path, ...)
或者只是在示例中添加内联样式:
Or just add an inline style in the example:
plotOutput(outputId = "main_plot", height = "300px" style="background-color:pink;"),
这篇关于我怎样才能简单地添加一个css文件来更改我闪亮的应用程序的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!