about summary refs log tree commit diff
path: root/src/librustdoc/html/static/css/rustdoc.css
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-09-01 23:59:46 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-09-02 00:02:03 +0200
commit01d8235ae1f388f896bf5a504077cd5101ae8fca (patch)
tree657b68d3a870cfe716d53e9eaa04237be5e9bec3 /src/librustdoc/html/static/css/rustdoc.css
parent5a8563262342d89da0899b2fda4436cb6f367660 (diff)
downloadrust-01d8235ae1f388f896bf5a504077cd5101ae8fca.tar.gz
rust-01d8235ae1f388f896bf5a504077cd5101ae8fca.zip
Fix scraped examples background gradient
Diffstat (limited to 'src/librustdoc/html/static/css/rustdoc.css')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 9d3a8c6bc14..6b31c596c40 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -2282,8 +2282,13 @@ in src-script.js and main.js
 	.example-wrap.scraped-example .button-holder {
 		top: calc(var(--pre-line-height) + 4px);
 	}
+	.scraped-example:not(.expanded)::before {
+		/* The gradient effect needs to be moved under the title */
+		top: var(--pre-line-height);
+	}
 }
 
+
 /* Should have min-width: (N + 1)px where N is the mobile breakpoint above. */
 @media (min-width: 701px) {
 	/* Places file-link for a scraped example on top of the example to save space.
@@ -2305,6 +2310,12 @@ in src-script.js and main.js
 	.item-table > li > div {
 		overflow-wrap: anywhere;
 	}
+
+	/* Starting this width, the "title" of scraped example will be in the code block so we can
+	put the background gradient at the top. */
+	.scraped-example:not(.expanded)::before {
+		top: 0;
+	}
 }
 
 @media print {
@@ -2395,7 +2406,6 @@ in src-script.js and main.js
 	z-index: 1;
 }
 .scraped-example:not(.expanded)::before {
-	top: 0;
 	background: linear-gradient(to bottom,
 		var(--scrape-example-code-wrapper-background-start),
 		var(--scrape-example-code-wrapper-background-end));