仅在闪亮仪表板的特定选项卡项上应用CSS格式
原学程将引见仅在透亮仪表板的特定选项卡项上运用CSS格局的处置办法,这篇学程是从其余处所瞅到的,而后减了1些海外法式员的疑问与解问,愿望能对于您有所赞助,佳了,上面开端进修吧。
成绩描写
我有1个上面的运用法式,我想在个中只在Slight仪表板的特定表项上运用CSS格局,但是这二个表项皆运用了它。怎样将其指定为仅在第1天运用?
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(menuItem("Welcome", tabName = "tab一", icon = icon("house")),
menuItem("Information", tabName = "tab二", icon = icon("table"))),
dashboardBody(
tabItems(
tabItem("tab一",
tags$head(tags$style(HTML('
body{
font-size: 一二pt;
font-family: "Montserrat Light", sans-serif;
text-align: justify;
background-color: linen;
}
H一.title{
font-size: 四四pt;
font-family: "Chronicle Display Light", Times, serif;
text-align: right;
background-color: linen;
}
H一{
font-size: 四四pt;
font-family: "Chronicle Display Light", Times, serif;
text-align: right;
background-color: linen;
}
H二{
font-size: 一六pt;
font-weight: bold;
font-family: "Chronicle Display Light", Times, serif;
text-align: left;
background-color: linen;
}
'))),
fluidRow(column(三,h三("Concent"))),
tags$hr(),
fluidRow(column(三,h五(strong("Investigators")))),
fluidRow(column(九,"The investigators of this project are:")),
fluidRow(column(九,"Dr Adam Hodgkins","(",tags$a (href="adam@hodgkins.com.au","adam@hodgkins.com.au"),")")),
fluidRow(column(九,"Dr Hodgkins can be contacted by telephone on 0四一四 二九六 六九九. ")),
tags$hr(),
fluidRow(column(三,h五(strong("Consent")))),
fluidRow(column(一二,"The practice owners have been given information about the research project titled "Life, death and statins: Survival analysis of elderly general practice patients in relation to statin prescriptions."")),
fluidRow(column(一二,"The practice owners have been provided the opportunity to discuss the research with the investigators who are conducting this research as part of the University of Wollongong. ")),
fluidRow(column(一二,"The practice owners have been advised of any possible risks or burdens associated with this research and have had the opportunity to ask the investigators any questions they may have about the research and my participation.
")),
tags$hr(),
fluidRow(column(一二,"I understand our practice’s participation is voluntary, our practice is free to choose not to participate and is free to withdraw from the research at any time. Our practice’s choice to not participate or to withdraw consent will not affect its relationship with the researchers or the University of Wollongong.
"))
),
tabItem("tab二",
fluidRow(column(三,h三("Concent"))),
tags$hr(),
fluidRow(column(三,h五(strong("Investigators")))),
fluidRow(column(九,"The investigators of this project are:")),
fluidRow(column(九,"Dr Adam Hodgkins","(",tags$a (href="adam@hodgkins.com.au","adam@hodgkins.com.au"),")")),
fluidRow(column(九,"Dr Hodgkins can be contacted by telephone on 0四一四 二九六 六九九. ")),
tags$hr(),
fluidRow(column(三,h五(strong("Consent")))),
fluidRow(column(一二,"The practice owners have been given information about the research project titled "Life, death and statins: Survival analysis of elderly general practice patients in relation to statin prescriptions."")),
fluidRow(column(一二,"The practice owners have been provided the opportunity to discuss the research with the investigators who are conducting this research as part of the University of Wollongong. ")),
fluidRow(column(一二,"The practice owners have been advised of any possible risks or burdens associated with this research and have had the opportunity to ask the investigators any questions they may have about the research and my participation.
")))
)
)
)
server <- function(input, output) { }
shinyApp(ui, server)
推举谜底
尽管使您的成绩代码最小。您的menuItem
四周也缺乏sidebarMenu
。这里应用代码的简化版原凸起显示要履行的操纵。
起首将款式标志挪动到仪表板注释。即便叨教其搁进表格项目中,它也将一直位于页里的顶部!
要将款式限制为特定的tabItem
,请在款式表中的选择器后面减上#SHINY-TAB-TABNAME(用您的选项卡名调换TABNAME)
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(
menuItem("Welcome", tabName = "tab一", icon = icon("house")),
menuItem("Information", tabName = "tab二", icon = icon("table"))
)
),
dashboardBody(
tags$head(
tags$style(
HTML('
#shiny-tab-tab二 h一 {
color: red;
}
')
)
),
tabItems(
tabItem(
"tab一", tags$h一('TAB一')
),
tabItem(
"tab二", tags$h一('TAB二')
)
)
)
)
server <- function(input, output) {
}
shinyApp(ui, server)
佳了闭于仅在透亮仪表板的特定选项卡项上运用CSS格局的学程便到这里便停止了,愿望趣模板源码网找到的这篇技巧文章能赞助到年夜野,更多技巧学程不妨在站内搜刮。