如何在flexdashboard的导航栏的右上角添加徽标?

问题描述

我正在使用flexdashboard包在R中构建仪表板(下面的图像)。我正在寻找一种解决方案,以便在nav-bar的右上角添加徽标,以保持nav-bar的大小不变

这是我的YAML

---
title: "Inflation & PSCE Outlook"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---
<style>
.navbar,[data-toggle=tab],.navbar-brand  {   background-color:#75002B;   border-color:black;   color:white; }
</style>



解决方法

您可以使用徽标选项为仪表板指定徽标图像,如下所示。

可以使用以下CSS将徽标添加到右侧。

---
title: "Inflation & PSCE Outlook"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    logo: path/to/logo.png
---
<style>
.navbar,[data-toggle=tab],.navbar-brand  {   background-color:#75002B;   border-color:black;   color:white; }

.navbar-logo img {
    position: absolute;
    right: 0px;
}
</style>