Text is not vertically centered on tooltips

Aperta Adatta ai principianti
#43,482 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bootstrap, css, scss
Ambito
frontend

Direzione di ricerca

Inizia leggendo gli stili dei tooltip che impostano --tooltip-font-size ed esamina come viene ereditato line-height per il testo dei tooltip. Secondo la segnalazione, il line-height ereditato causa un pixel in più sotto il testo; riproduci il problema nella pagina del menu collegata con una scala 1:1. Il lavoro è concluso quando il testo e le icone dei tooltip appaiono centrati verticalmente nei browser segnalati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug confirmed css has-pr v6
Prerequisites
Describe the issue

The text & icons on the menu items are not vertically centered. This is very noticeable on 1:1 scaling. This issue might not be so visible on high-DPI screens (2:1 or 3:1), due to how scaling works.

issue-3-1

A zoomed-in view better shows this issue:

Screenshot 2026-11-26 173631

This issue is caused by the line-height being ommited, and therefore inherited to 1.5. Because --tooltip-font-size is set to .875rem, the computed line height is 21px, so there's an additional pixel that's being is present at the bottom row ( computed line height is 21px, the font-size is 14px, so there's 3px at the top and 4px at the bottom for the height-line).

Reduced test cases

Go to: https://getbootstrap.com/docs/6.0/components/menu/ on a screen that does not do any scaling (1:1 mapping), open a tooltip, and observe the tool;tip text not being vertically centered.

What operating system(s) are you seeing the problem on?

Linux, iOS, Android, macOS, Windows

What browser(s) are you seeing the problem on?

Opera, Microsoft Edge, Firefox, Safari, Chrome

What version of Bootstrap are you using?

v6

Lingua principale
JavaScript
Stelle
175k
Fork
78.9k
Merge medio
4g 2h
PR unite (30g)
89

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di twbs/bootstrap

Tutte le issue di twbs/bootstrap

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.