如何移除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
相关产品推荐
相关产品推荐

