如何在rmarkdown中的导航栏标题字段中添加自定义徽标?

时间:2017-05-26 14:59:52

标签: html css r-markdown

我想在导航栏标题字段部分添加自定义徽标。我尝试添加一个html脚本并且它有效,但徽标图像不适合导航栏内部 - 徽标被边缘推开,菜单文本与徽标等重叠。

name: "my-website"
output_dir: .
navbar:
  title: "I want to add custom logo here"
  left:
- text: "Home"

2 个答案:

答案 0 :(得分:1)

我自己弄乱了一个网站。这对我有用:

name: "my-website"
navbar:
  title: "<img id=\"logo\" style=\"width: 30px;\" src=\"dog.gif\" />"
  left:
    - text: "Home"
      href: index.html
    - text: "About"
      href: about.html

enter image description here

答案 1 :(得分:1)

您可以在YAML上指定。例如,如果使用flexdashboard:

---
title: "My Website"
output: 
  flexdashboard::flex_dashboard:
    theme: flatly
    logo: LOGO.png
---

请注意,徽标图像上没有缩放,因此它应该完全适合导航栏的尺寸(默认的“cosmo”主题高48像素,其他主题可能略有不同的导航栏高度)。

相关问题