1 回答

TA貢獻1836條經(jīng)驗 獲得超13個贊
以下是使用 CSS 的方法:
library(shiny)
library(shinydashboard)
body <- dashboardBody(
? tags$style(
? ? type = 'text/css',
? ? '.fa, .fas {
? ? ? font-weight: 900;
? ? ? color: black;
? ? }'
? ),
? fluidRow(
? ? box(status = "info", solidHeader = TRUE,?
? ? ? ? title = "Background - Hypothetical Life",?
? ? ? ? width = "auto", collapsible = TRUE, collapsed = TRUE,
? ? ? ? h5("sample text"))))
ui <- dashboardPage(
? dashboardHeader(title = "Box"),
? dashboardSidebar(),
? body
)
server = function(input, output, session) { }
shinyApp(ui = ui, server = server)
當你想更改 CSS 樣式中的某些內(nèi)容但并不真正了解 CSS(像我一樣)時,請在瀏覽器中啟動你的應用程序,執(zhí)行“檢查元素”(右鍵單擊或 Ctrl+Shift+C) )并檢查“檢查器”。它會顯示每個元素的 CSS 描述。
tags$style
然后,像上面的示例一樣放入此 CSS 代碼,并添加一些參數(shù)來自定義它。網(wǎng)上有很多關于 CSS 的資源。
例如,在上面的例子中,我在“Inspector”中看到圖標CSS樣式是:
.fa,?.fas?{ ???font-weight:?900; }
所以我只是把它放在 a 中tags$style
,然后搜索修改圖標顏色所需的參數(shù)是什么。
- 1 回答
- 0 關注
- 171 瀏覽
添加回答
舉報