在整个R Shiny应用程序中更改字体系列:CSS/HTML [英] Change font family throughout entire R Shiny App: CSS/HTML

查看:76
本文介绍了在整个R Shiny应用程序中更改字体系列:CSS/HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以更改整个闪亮的仪表板应用程序的默认字体?包括应用程序中的边栏,正文,标题,ggplots等的字体?

Is it possible to change the default font of an entire shiny dashboard app? Including font for the sidebar, body, header, ggplots within the app, etc?

我知道您可以在每篇文章中添加字体系列说明 (例如:h2(strong(textOutput("t")),style ="font-family:'Arial';")), 但是我希望我的整个应用程序都使用Arial,并且我不想为每个功能都编写一行代码.有捷径吗?

I know you can add font-family statements within each piece ( example: h2(strong(textOutput("t")), style = "font-family: 'Arial';")), but I want my entire app to use Arial and I don't want to have to write a line of code for every single feature. Is there a short cut?

此外,如果可能的话,内联CSS优于单独的CSS文件.

Also, inline CSS is preferred to a separate css file if possible.

谢谢, 莎拉

这是我的一些代码.您能告诉我在哪里放置必要的CSS吗?

body<-dashboardBody( tags$style(".content {background-color: black;}"),
                 useShinyjs(),
                 tags$style(type='text/css', ".skin-blue .main-header .logo {background-color: #000000}" ),
                 tags$style(type='text/css', ".skin-blue .main-header .logo:hover {background-color: #000000}"),
                 tags$style(type='text/css', ".skin-blue .main-header .navbar {background-color: #000000}"),
                 tags$style(type="text/css",".shiny-output-error { visibility: hidden; }",".shiny-output-error:before { visibility: hidden; }"),
                 fluidPage(
                   img(src="img2.PNG",height="100%", width="100%",style='padding:0px;'),
                   br(),br(),
                   tabBox("Menu Database", width = 12,
                          tabPanel("Menu Database", 
                                   tabsetPanel(
                                     tabPanel("LTO Survey results",

推荐答案

您可以将所需的font-family放入body选择器

You can put the font-family you want in a body selector

body {
  font-family: Arial;
}

或者使用通用选择器*将更改每个元素

Or using the universal selector * will change every element

* { font-family: Arial; }

这篇关于在整个R Shiny应用程序中更改字体系列:CSS/HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆