User:Astrid/sandbox/hover box/styles.css

.hoverbox { padding: 0.25em 0.5em; display: inline-block; line-height: 1; /*font-family: monospace;*/ font-weight: 500; font-size: 0.875rem; border-radius: var(--border-radius--small); white-space: nowrap; background: var( --color-surface-2 ); color: var( --color-base--emphasized ); transition: 0.5s; } .hoverbox:hover + .hoverbox1 { display:none; } .hoverbox:hover + .hoverbox2 { display:inline-block; } .hoverbox:hover { background: var( --color-surface-3 ); }