about summary refs log tree commit diff
path: root/src/librustdoc/html/static
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-09-01 23:43:27 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-09-01 23:43:27 +0200
commit5a8563262342d89da0899b2fda4436cb6f367660 (patch)
treeee34cb9e839324dc084ad21dca9fc04b311633be /src/librustdoc/html/static
parent4825fb198f9abb58ddc877d9bbf49c8834a68a68 (diff)
Correctly handle code examples buttons position
Diffstat (limited to 'src/librustdoc/html/static')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 87499445767..9d3a8c6bc14 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -34,6 +34,7 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
 </g></svg>');
 	--button-left-margin: 4px;
 	--button-border-radius: 2px;
+	--pre-line-height: 1.5rem;
 }
 
 /* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -365,7 +366,7 @@ code, pre, .code-header {
 }
 pre {
 	padding: 14px;
-	line-height: 1.5; /* https://github.com/rust-lang/rust/issues/105906 */
+	line-height: var(--pre-line-height); /* https://github.com/rust-lang/rust/issues/105906 */
 }
 pre.item-decl {
 	overflow-x: auto;
@@ -2278,6 +2279,9 @@ in src-script.js and main.js
 		/* Dirty hacky to force it to remain on the same line as the line numbers. */
 		width: 10px;
 	}
+	.example-wrap.scraped-example .button-holder {
+		top: calc(var(--pre-line-height) + 4px);
+	}
 }
 
 /* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */