This Tampermonkey script disables two visual UI behaviors on YouTube:
- The hover/focus highlight effect on rich video items.
- An unwanted top padding introduced by an experimental class (
efyt-control-bar-position-absolute).
This helps maintain a cleaner and less visually intrusive layout while browsing YouTube.
- Removes background highlight and border glow on focused video items.
- Disables top
padding: 36pxon various watch page components. - Automatically applies even as YouTube dynamically loads content.
-
A modern browser like Chrome or Firefox.
-
Tampermonkey extension installed:
- Stop using Google Chrome
- Tampermonkey for Firefox
-
Install Tampermonkey
- Use the appropriate link above and add it to your browser.
-
Create a New Script
- Click the Tampermonkey icon in your browser toolbar.
- Select Dashboard β + Create a new script.
-
Paste the Script
- Delete the default template and paste the script below:
// ==UserScript==
// @name Disable YouTube Focus and Padding Effects
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Disable focus and padding-top effects on YouTube UI elements.
// @match *://www.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const style = document.createElement('style');
style.innerHTML = `
/* Disable highlight & border effects */
.ytd-rich-item-renderer-highlight,
.ytd-rich-item-renderer-highlight-border {
background-color: transparent !important;
box-shadow: none !important;
}
/* Override YouTube padding from experimental UI class */
html.efyt-control-bar-position-absolute ytd-watch-flexy[theater] #columns.ytd-watch-flexy,
html.efyt-control-bar-position-absolute ytd-watch-flexy:not([theater]) #columns #primary #alerts.ytd-watch-flexy:not(:empty),
html.efyt-control-bar-position-absolute ytd-watch-flexy:not([theater]) #columns #primary #messages.ytd-watch-flexy:not(:empty),
html.efyt-control-bar-position-absolute ytd-watch-flexy:not([theater]) #columns #primary #clarify-box.ytd-watch-flexy:not(:empty),
html.efyt-control-bar-position-absolute ytd-watch-flexy:not([theater]) #columns #primary #limited-state.ytd-watch-flexy:not(:empty),
html.efyt-control-bar-position-absolute ytd-watch-flexy:not([theater]) #columns #primary ytd-watch-metadata.ytd-watch-flexy:not([hidden]),
html.efyt-control-bar-position-absolute ytd-watch-flexy:not([theater]) #columns #primary div.watch-active-metadata.ytd-watch-flexy {
padding-top: 0px !important;
}
`;
document.head.appendChild(style);
})();-
Save the Script
- Press
Ctrl + Sor use File β Save in the Tampermonkey editor.
- Press
-
Enable the Script
- Ensure the script is toggled to Enabled in Tampermonkey.
-
Refresh YouTube
- Reload YouTube to see the effect take place.
- Visit YouTube's homepage and hover over any video item β the glow or highlight should be gone.
- On a video watch page, inspect layout spacing. The unwanted
padding-top: 36pxshould no longer be present.
- β Make sure Tampermonkey is installed and active.
- β Confirm the script is enabled.
- π Try refreshing YouTube if changes donβt appear immediately.
- π§ͺ Check browser console (
F12β Console) for script injection errors.
If problems persist, feel free to open an issue!
MIT License. Free to use and modify.
Feel free to submit pull requests or suggest improvements!