简体   繁体   中英

How to hide/remove tabBox grey borders in shiny R using CSS

I have shiny application with tabBox as shown below:

library(shiny)
library(shinydashboard)
body <- dashboardBody(
  fluidRow(tags$style(".nav-tabs {
                      background-color: #006747;
                      }
                      
                      .nav-tabs-custom .nav-tabs li.active:hover a, .nav-tabs-custom .nav-tabs li.active a {
                      background-color: transparent;
                      border-color: transparent;
                      }
                      
                      .nav-tabs-custom .nav-tabs li.active {
                      border-top-color: #990d5e;
                      }
                      
                      .content-wrapper {
                       background-color: #FFF;
                      }"),
                tabBox(
                  title = "First tabBox",
                  # The id lets us use input$tabset1 on the server to find the current tab
                  id = "tabset1", height = "250px",
                  tabPanel("Tab1", "First tab content"),
                  tabPanel("Tab2", "Tab content 2")
  )
  
  ))

shinyApp(
  ui = dashboardPage(
    dashboardHeader(title = "tabBoxes"),
    dashboardSidebar(),
    body
  ),
  server = function(input, output) {
  }
)

在此处输入图像描述

I would like to hide/remove the grey border lines of the tabBox on all sides as indicated by arrows in the picture.

Could someone help which CSS class has to be used to make this change?

You can set box-shadow: none; for class .nav-tabs-custom :

library(shiny)
library(shinydashboard)
body <- dashboardBody(
  fluidRow(tags$style(".nav-tabs {
                      background-color: #006747;
                      }
                      
                      .nav-tabs-custom .nav-tabs li.active:hover a, .nav-tabs-custom .nav-tabs li.active a {
                      background-color: transparent;
                      border-color: transparent;
                      }
                      
                      .nav-tabs-custom .nav-tabs li.active {
                      border-top-color: #990d5e;
                      }
                      
                      .content-wrapper {
                       background-color: #FFF;
                      }
                      .nav-tabs-custom {
                          box-shadow: none;
                      }
                      "),
           tabBox(
             title = "First tabBox",
             # The id lets us use input$tabset1 on the server to find the current tab
             id = "tabset1", height = "250px",
             tabPanel("Tab1", "First tab content"),
             tabPanel("Tab2", "Tab content 2")
           )
           
  ))

shinyApp(
  ui = dashboardPage(
    dashboardHeader(title = "tabBoxes"),
    dashboardSidebar(),
    body
  ),
  server = function(input, output) {}
)

结果

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM