diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css
index 38040eeca52d4..6ed7845e83a35 100644
--- a/src/librustdoc/html/static/css/themes/ayu.css
+++ b/src/librustdoc/html/static/css/themes/ayu.css
@@ -351,11 +351,8 @@ a.test-arrow:hover {
color: #999;
}
-:target, :target > * {
- background: rgba(255, 236, 164, 0.06);
-}
-
:target {
+ background: rgba(255, 236, 164, 0.06);
border-right: 3px solid rgba(255, 180, 76, 0.85);
}
diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css
index f4181e431c896..64b6eb6696b83 100644
--- a/src/librustdoc/html/static/css/themes/dark.css
+++ b/src/librustdoc/html/static/css/themes/dark.css
@@ -295,11 +295,8 @@ a.test-arrow:hover{
color: #999;
}
-:target, :target > * {
- background-color: #494a3d;
-}
-
:target {
+ background-color: #494a3d;
border-right: 3px solid #bb7410;
}
diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css
index 176f63098a49f..dbacc9f30735b 100644
--- a/src/librustdoc/html/static/css/themes/light.css
+++ b/src/librustdoc/html/static/css/themes/light.css
@@ -284,11 +284,8 @@ a.test-arrow:hover{
color: #999;
}
-:target, :target > * {
- background: #FDFFD3;
-}
-
:target {
+ background: #FDFFD3;
border-right: 3px solid #AD7C37;
}