【问题标题】:Make dashboard box title bold using CSS使用 CSS 使仪表板框标题加粗
【发布时间】:2018-03-27 20:07:15
【问题描述】:

我正在为 R Shiny 应用程序使用 R Shiny 仪表板。我已经包含 css 文件来设置应用程序的样式。我需要将框标题更改为粗体。下面是ui.R的最小示例

library(shiny)
library(shinydashboard)

body <-
  dashboardBody(tags$head(
    tags$link(rel = "stylesheet", type = "text/css", href = "my_style.css")
  ),
  tabItems(tabItem(tabName = "test",
                   fluidRow(
                     box(
                       collapsible = TRUE,
                       width = 3,
                       status = "primary",
                       solidHeader = T,
                       title = "Test"
                     )
                   ))))

dashboardPage(dashboardHeader(), dashboardSidebar(), body)

下面是my_style.css文件

.box.box-solid.box-primary>.box-header{
  background: rgb(0, 129, 201);
  color: #ffffff;
    font-size: 18px;
  font-weight; bold;
}

.box.box-solid.box-primary{
  font-family: OpenSans;
  font-size: 16px;
  text-align: left;
  color: #000000;
}

问题出在 .box-header 部分。框改变背景颜色和文本颜色;但不是字体大小和字体粗细。

有什么建议吗?

【问题讨论】:

    标签: html css r shiny shinydashboard


    【解决方案1】:

    怎么样:

    .box-header h3 {
       font-weight: bold;
    }
    

    【讨论】:

    • 好主意!我发现错字fonts-weight: bold;
    【解决方案2】:

    对于任何想要增加字体大小的人,您将需要一个额外的参数(或者至少我这样做了):

    .box-header h3.box-title {
       font-weight: bold;
       font-size: 24px;
    }
    

    【讨论】:

      猜你喜欢
      • 2017-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-13
      • 1970-01-01
      • 2021-05-19
      • 2023-01-26
      相关资源
      最近更新 更多