Files
gitea/web_src/css/modules/navbar.css
T
k3n 3ceec49229 fix(ui): center notification badge count and normalize dimensions (#40400)
Fixes #33479

The notification count, stopwatch dot, and navbar admin badge appeared
vertically sunken / uncentered on high-DPI displays (such as 1440p) and
across varying browser zoom levels.

This was caused by:
1. Fractional horizontal padding (3.75px) and odd height (17px with 2px
borders = 13px content height), causing subpixel rounding splits during
flexbox alignment.
2. A fixed line-height (12px) which offset the baseline of un-descended
numerals within the flex container.

This change:
- Updates height and min-width to 18px (14px inner content box) for
clean integer alignment.
- Sets line-height to 1 for tight font bounding box centering.
- Normalizes horizontal padding to 4px.
- Adjusts font-size to 11px to preserve comfortable spacing inside the
badge.
- Replaces hardcoded border-radius with var(--border-radius-full).

Signed-off-by: Francesco Passaquindici <k3n.solver@gmail.com>

Signed-off-by: Francesco Passaquindici <k3n.solver@gmail.com>
2026-11-17 18:41:39 +00:00

130 lines
2.5 KiB
CSS

#navbar {
background: var(--color-nav-bg);
border-bottom: 1px solid var(--color-secondary);
padding: 0 10px;
}
#navbar,
.navbar-list {
display: flex;
align-items: center;
gap: 5px;
}
#navbar > .item,
#navbar > .navbar-list > .item {
flex: 0 0 auto;
display: flex;
align-items: center;
color: var(--color-nav-text);
text-decoration: none;
min-height: 36px;
min-width: 36px;
padding: 3px 13px;
border-radius: 4px;
}
#navbar-logo {
margin: 6.5px 0; /* center the 36px items in the 49px row */
}
#navbar > .item.active,
#navbar > .navbar-list > .item.active {
background: var(--color-active);
}
#navbar > .item:hover,
#navbar > .navbar-list > .item:hover {
background: var(--color-nav-hover-bg);
}
#navbar > .navbar-list > .item.ui.dropdown {
padding-right: 5px;
}
#navbar > .navbar-left {
margin-right: auto;
}
@media (max-width: 767.98px) {
#navbar {
flex-wrap: wrap;
row-gap: 0;
}
#navbar-logo {
margin-right: auto;
}
#navbar-expand-toggle {
order: 1;
}
.navbar-list {
display: none;
order: 2;
width: 100%;
flex-direction: column;
align-items: stretch;
}
.navbar-left {
margin-top: 5px;
}
.navbar-menu-open .navbar-list {
display: flex;
}
#navbar.navbar-menu-open {
padding-bottom: 8px;
}
}
#navbar .item:hover .notification_count,
#navbar .item:hover .header-stopwatch-dot,
#navbar .item:hover .navbar-admin-badge,
#navbar .item.active .navbar-admin-badge {
border-color: var(--color-nav-hover-bg);
}
#navbar .notification_count,
#navbar .header-stopwatch-dot,
#navbar .navbar-admin-badge {
color: var(--color-nav-bg);
padding: 0 4px;
font-size: 11px;
line-height: 1;
font-weight: var(--font-weight-bold);
background: var(--color-primary);
border: 2px solid var(--color-nav-bg);
position: absolute;
left: calc(100% - 9px);
bottom: calc(100% - 9px);
min-width: 18px;
height: 18px;
border-radius: var(--border-radius-full);
display: flex;
align-items: center;
justify-content: center;
z-index: 1; /* prevent menu button background from overlaying icon */
user-select: none;
white-space: nowrap;
overflow: visible;
}
.navbar-avatar {
position: relative;
display: inline-flex;
}
#navbar .navbar-admin-badge {
left: auto;
right: -7px;
bottom: -5px;
padding: 1.5px;
}
.secondary-nav {
background: var(--color-secondary-nav-bg) !important; /* important because of .ui.secondary.menu */
}
.issue-navbar {
display: flex;
justify-content: space-between;
}