【问题标题】:How do I add custom logo in navbar title field in rmarkdown?如何在 rmarkdown 的导航栏标题字段中添加自定义徽标?
【发布时间】:2017-05-26 14:59:51
【问题描述】:

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

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

【问题讨论】:

标签: html css r-markdown


【解决方案1】:

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

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

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

【讨论】:

    【解决方案2】:

    好吧,我自己摆弄了一个网站。这对我有用:

    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
    

    【讨论】:

    • 太棒了!我也让它工作。也许我问的太多了,但是有没有办法忽略边距?
    • 边距到底是什么意思?图片下方和上方的空间?
    • @MartinSchmelzer 是的。如果我们选择的宽度太大,图像上方似乎有不可压缩的边距
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-09
    • 1970-01-01
    • 2018-10-24
    • 2020-12-16
    • 2014-01-29
    • 2023-03-13
    • 1970-01-01
    相关资源
    最近更新 更多