Skip to content

Htmx on links doesn't appear as link #2994

Answered by Telroshan
florian-sun asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, that's normal as htmx doesn't apply any styling (except the default indicator classes), and since browsers don't know about htmx, they use their standard link styling strategy. Without a href attribute defined, browsers will render your link like a simple text instead of the style you would expect.

To make a link look like what you would expect, you can either

  • Set its href attribute.
    In this case, you'll probably want to define href="/mylink". Be aware though that this will let your users right click + open in new tab, which is usually what you want from a link, just don't forget to handle partial swap response vs full page load (you can rely on the HX-Request header for that, see the

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by florian-sun
Comment options

You must be logged in to vote
1 reply
@Telroshan
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants