除了项目名称之外,如何在闪亮的仪表板中添加徽标?

Cs2*_*s20 5 html css r shiny shinydashboard

请你帮我在闪亮的仪表板的左上角除了项目名称之外添加公司徽标。

我试图在 stackoverflow 上的其他答案中使用代码,但仍然无法解决我的问题。我对 HTML 和 css 一无所知。

这是我的代码:

library(shiny)
library(shinydashboard)
shinyApp(
ui = dashboardPage(skin = "green", 
dashboardHeader(title = "Project name", 
 # this could show the logo but not where I wanted !
 tags$li(a(href = 'http://www.company.com',
              img(src = 'logo.jpg',
              title = "Company Home", height = 30px"),
           style = "padding-top:10px; padding-bottom:10px;"),
                    class = "dropdown"))),
dashboardSidebar(),
dashboardBody()
),
server = function(input, output) {}
)
Run Code Online (Sandbox Code Playgroud)

显示我想如何添加徽标的图片

谢谢

Jae*_*Kim 5

可以按如下方式并排设置图像和文本。

library(shiny)
library(shinydashboard)

header <- dashboardHeader()
anchor <- tags$a(href='http://www.example.com',
                 tags$img(src='logo.png', height='60', width='50'),
                 'project name')

header$children[[2]]$children <- tags$div(
    tags$head(tags$style(HTML(".name { background-color: black }"))),
    anchor,
    class = 'name')

ui <- dashboardPage(header, dashboardSidebar(), dashboardBody())

shinyApp(ui, server = function(input, output, session) {})
Run Code Online (Sandbox Code Playgroud)