[英]How to make the size of icon consistent when using Shiny and Shinydashboard?
[英]Icon in shiny/ shinydashboard
如果只是圖標,您將在這里找到它:
https://fontawesome.com/icons/circle?style=regular
但是,如果您想在內部顯示一個數字,則可以使用純CSS來實現。
library(shiny)
ui <- fluidPage(
titlePanel("Circle"),
sidebarLayout(
sidebarPanel(
includeCSS("www/style.css"),
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
tags$div(id="insidediv", textOutput("slideroutput"))
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$slideroutput <- renderText({
input$bins
})
}
# Run the application
shinyApp(ui = ui, server = server)
CSS文件:
#insidediv {
background-color:#fff;
border:4.5px solid grey;
height:100px;
border-radius:50%;
-moz-border-radius:50%;
-webkit-border-radius:50%;
width:100px;
}
#slideroutput {
padding-top: 30px;
padding-bottom: 30px;
text-align: center;
font-weight: bold;
font-size: 24px;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.