Hide the Hashtag (#) in Tags with CSS!

This snippet works in reading mode with all themes. Essentially, it makes the # symbol appear as a blank space (using a font that does not render #s), then manipulates padding to make it seem as if it isn’t there.

The # symbol is visible again on hover.

Copy the Snippet
/* === import the Formular font, which doesn't render hashtags (#) */

/* this @font-face was generated using transfonter.org, where I specified it to include only U+0023, the hashtag (#) sign. I did this because Formular cannot render hashtags. */
@font-face {
    font-family: 'Formular';
    src: url('data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAXMAA4AAAAACOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHREVGAAAFZAAAABYAAAAWABMABkdQT1MAAAV8AAAAIAAAACBEdkx1R1NVQgAABZwAAAAvAAAAMCN+JIxPUy8yAAACDAAAAEcAAABgII84HWNtYXAAAAJUAAAAMQAAADwAOwB9Z2FzcAAABVwAAAAIAAAACP//AANnbHlmAAABRAAAACgAAAAoKX11F2hlYWQAAAGcAAAANgAAADYW4dEnaGhlYQAAAewAAAAgAAAAJA/2Cc9obXR4AAAB1AAAABgAAAAYDeYAd2xvY2EAAAGMAAAADQAAAA4APAA8bWF4cAAAAWwAAAAeAAAAIABLAEVuYW1lAAACiAAAAq4AAAXocAf8uHBvc3QAAAU4AAAAJAAAADNVXVC5AAIAdwAAA8MFtgADAAcAADMRIRElIREhdwNM/T8CNf3LBbb6SoEEtHjaY2BkYGBgY3BiYGYAASYgZmQAiTmA+QwACZIAkQAAeNpjYGAQQUAAAt4AeQAAAAABAAAAAgCDDlp/b18PPPUACwgAAAAAAM8sf4QAAAAA4KMGkP+m/lgITAc7AAAACAACAAAAAAAABDkAdwAAAAACqgAAAAAAAAI5AAAEygAAeNpjYGRgYLP8Z8l4krv//zIGBg4fBqAICmADAH24BNx42mNgZrnJOIGBlYGB1ZjlLAMDwywIzXSWIY0pC0gzIAFGBnTgwKDAoMxm+c+S8ST7XcY3CgwM08EKfzCdAlIKDEwAU4UM+QB42mNgYGBiYGBgBmIRIMkIplkYNIA0G5BmBMoqMCj//w/k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AAAAB42mNgZGBg4GLQYdBjYHZx8wlhEEmuLMphkMtJLMljkGNgAcoy/P/PAAcArlkHTgA=') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/*-------------------------*/

/* ===== tags ======== */
body {
  --tag-radius: 7px;
}

/* hide tag hashtags (#) */
a.tag  {
   font-family: 'Formular', var(--font-text); /* Formular does not render hashtags */
  /* First, the tags will use Formular. The only character in Formular's unicode range is the # symbol, 
  so after it renders the symbol, it falls back to the normal font of the theme */
}


/* To make it clear that the tags are still tags, the # symbols appear again on hover. */
a.tag:hover {
    font-family:  var(--font-text); /* the font only uses the normal theme font, so the #s render again. */
}

/* change the padding to hide the space that would be occupied by the # symbol */
 a.tag:not(.basename-tag) { /* we don't want this to affect tags when the Basetag Renderer plugin is active, though */
    padding: 5px 0.55em 5px 0; 
    text-align: center; 
     text-decoration: none !important;
    transition: 0.2s; /* this makes the # appear more smoothly on hover */
}

a.tag:not(.basename-tag):hover { /* change the padding a bit on hover when the # appears again. */
    padding: 5px 7px 5px 7px !important;
}

/* prevent overlapping tags on separate lines */
p:has(a.tag) {
line-height: 1.7; 
}

}

5 Likes