2017-05-26 120 views
2

我想在导航栏标题字段部分添加一个自定义徽标。我尝试添加一个HTML脚本和它的工作,但徽标图像不适合导航栏里面亲切 - 该标志是由边缘推下,菜单文字重叠的标识等如何在rmarkdown的导航栏标题栏中添加自定义徽标?

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

你可以发布一个工作最小化的Rmarkdown文档。 –

+0

也许你可以使用这个:https://stackoverflow.com/questions/38333691/r-markdown-putting-an-image-in-the-top-right-hand-corner-of-html-and-moving-tit – Lifka

+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

+0

太棒了!我也做到了。也许我问的太多了,但有没有办法忽略利润率? –

+1

你的利润率是什么意思?图像下方和上方的空间? –

0

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

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

注意,不结垢的标志图像上进行的,所以应该在导航栏的尺寸范围内完全适合(48个像素高默认“COSMO”的主题,其他主题可能会有略微不同的导航栏高度)。