r - 在闪亮仪表板标题部分的同一行中添加图像和标题
问题描述
我创建了一个闪亮的仪表板,我在其中设置了titleWidth
侧边栏宽度 = 0,以便隐藏它们。然后我想在标题部分的左角添加一个完全适合标题部分的图像,然后在同一行但在右上角添加标题。正如您现在看到的,标题部分变得更大,并且标题似乎比图像低一行。这是我的代码:
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyjs)
dbHeader <- dashboardHeaderPlus(
titleWidth = "0px",
tags$li(a(href = 'http://https://www.uow.edu.au/',
img(src = 'download.png',
height = "55px",width="232px"),
style = "padding-top:0px; padding-bottom:0px; padding-right:1690px;padding-left:90px;"),
class = "dropdown")
)
shinyApp(
ui = dashboardPagePlus(
header = dbHeader,
sidebar = dashboardSidebar(width = "0px"),
body = dashboardBody(
useShinyjs(),
tags$head(tags$style(".skin-blue .main-header .logo { padding: 0px;}")),
tags$head(tags$style(HTML(
'.myClass {
font-size: 25px;
line-height: 50px;
text-align: left;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
padding: 1500px;
padding-bottom: 0 0px;
padding-top: 0 0px;
overflow: hidden;
color: black;
}
'))),
tags$script(HTML('
$(document).ready(function() {
$("header").find("nav").append(\'<span class="myClass"> Life,Death & Statins </span>\');
})
'))
)
),
server<-shinyServer(function(input, output,session) {
hide(selector = "body > div > header > nav > a")
}
)
)
解决方案
也许你正在寻找这个。您可以使用填充和边距来获得适当的间距。
mytitle <- paste0("Life, Death and Statins")
dbHeader <- dashboardHeaderPlus(
titleWidth = "0px",
tags$li(a(href = "https://www.mit.edu/", # 'http://https://www.uow.edu.au/',
div(style = "margin-left:-15px;margin-bottom:-44px;margin-top:-15px;padding: 0px 1190px 0px 0px ; width: 290px;",
img(src = 'YBS.png', height = "55px",width="232px")),
div(style="display: inline; padding: 0px 90px 0px 750px ; font-size: 40px ; width: 300px;",HTML(mytitle, "<br>"))
),
class = "dropdown")
)
推荐阅读
- r - 模型拟合:从“nlmer”到“nlme”
- amazon-web-services - amazon-cognito-vuex-module 登录引发用户无权获取身份验证详细信息
- java - Maven Compile 无法从 rt.jar 中找到 jars
- javascript - 三.js动画曲线
- r - 对数据框进行子集化后,函数对子集不起作用
- unity3d - 移动键盘统一隐藏输入字段
- d3.js - 如何在 Ember 应用程序的 D3 垂直条形图中添加更新标签
- explorer - 使程序与网页中显示的内容相结合
- python - 奇怪的输出到txt文件?
- javascript - 如何在本机反应中为按钮设置计时器?