Skip to content

Commit d89198d

Browse files
committed
style(css): Position headerlink outside argument name element
Use absolute positioning to place the ¶ link outside the dt element to the right, rather than inline. Hover trigger moved to the wrapper element so the link appears when hovering anywhere on the argument block.
1 parent 358b3e8 commit d89198d

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

docs/_static/css/argparse-highlight.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ pre.argparse-usage {
295295
padding: .485rem .875rem;
296296
font-family: var(--font-stack--monospace);
297297
width: fit-content;
298+
position: relative;
298299
}
299300

300301
/*
@@ -308,11 +309,15 @@ pre.argparse-usage {
308309

309310
/*
310311
* Headerlink anchor (¶) - hidden until hover
312+
* Positioned outside the dt element to the right.
311313
* Follows Sphinx documentation convention for linkable headings.
312314
*/
313315
.argparse-argument-name .headerlink {
314316
visibility: hidden;
315-
margin-left: .5rem;
317+
position: absolute;
318+
right: -1.5rem;
319+
top: 50%;
320+
transform: translateY(-50%);
316321
color: var(--color-foreground-secondary);
317322
text-decoration: none;
318323
}
@@ -324,8 +329,8 @@ body:not([data-theme="dark"]) .argparse-argument-name .headerlink {
324329
/*
325330
* Show headerlink on hover or when targeted via URL fragment
326331
*/
327-
.argparse-argument-name:hover .headerlink,
328-
.argparse-argument-wrapper:target .argparse-argument-name .headerlink {
332+
.argparse-argument-wrapper:hover .headerlink,
333+
.argparse-argument-wrapper:target .headerlink {
329334
visibility: visible;
330335
}
331336

0 commit comments

Comments
 (0)