Add a button to website navbar #12196
-
DescriptionI am wanting to add a button in the navbar of a Quarto website. If I create a website using project:
type: website
website:
title: "button-in-navbar"
navbar:
left:
- href: index.qmd
text: Home
- href: https://quarto.org/
text: "<span class='btn btn-primary'>Click here</span>"
- href: about.qmd
text: About us
format:
html:
theme:
- cosmo
- brand
css: styles.css
toc: true
That does make a button, but the vertical alignment is not good: Notice how "Home" and "About us" are too high, while the title and button are vertically aligned nicely. I tried using How might I go about improving the vertical alignment in the navbar in this case? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
What you've done is totally reasonable, and our CSS would ideally work better. So I would start by debugging the CSS we get with the devtools. With that said, I'll reiterate: I think it should work pretty much like you've done. I also think we should have some syntax help for it, maybe something like a shortcode, eg |
Beta Was this translation helpful? Give feedback.
By inspecting the DOM and removing suspicious-looking classes, I can tell that (unsurprisingly) it's the
btn
class that's causing issues.Here's a hack to get you unstuck:
It's not an entirely trivial thing for us to fix in pure CSS because the padding in
.btn
is w…