You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何移除shinydashboardPlus::carousel轮播指示器的阴影背景与蓝色边框

解决方案

对应蓝色边框和阴影的元素类为.carousel-indicators li,其触发条件是元素的:focus、:active伪类状态,在现有CSS中补充以下规则即可移除效果:

.carousel-indicators li:focus,
.carousel-indicators li:active {
  outline: none !important;
  box-shadow: none !important;
}

修改后的完整可运行代码如下:

# Windows 10 64bit, R 4.1.0
library(shiny) # 1.6
library(shinydashboard) # 0.7.1
library(shinydashboardPlus) # 2.0.3

shinyApp(ui = dashboardPage(

  title = "Test",
  
  header  = dashboardHeader(),
  
  sidebar = dashboardSidebar(disable = TRUE,
                             width = "0px",
                             collapsed = TRUE),
  
  body = dashboardBody(
    
    tags$head(
      tags$style(HTML("
      .carousel-caption {
        display: none !important;      
      }
      /* 移除轮播指示器聚焦状态的边框和阴影 */
      .carousel-indicators li:focus,
      .carousel-indicators li:active {
        outline: none !important;
        box-shadow: none !important;
      }
      "))
    ),
    
    carousel(
      id = "mycarousel",
      carouselItem(
        caption = "Item 1",
        tags$img(src = "https://getbootstrap.com/docs/5.1/assets/img/bootstrap-icons.png")
      ),
      carouselItem(
        caption = "Item 2",
        tags$img(src = "https://getbootstrap.com/docs/5.1/assets/img/bootstrap-icons.png")
      )
    )
    ) # close dashboardBody
  ), # close dashboardPage 
server = function(input, output) {}
)

异常效果示意图:
轮播指示器异常样式示意图


内容的提问来源于stack exchange,提问作者TimTeaFan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.03 07:15:02