How to Apply Cosmetic Filtering in uBlock Origin to Exclude Video Tags on Websites

Abstract: Exclude video tags on websites using uBlock Origin cosmetic filtering to hide elements without blocking network requests.

Created: 2026-10-18 by

Use uBlock Origin’s custom filter syntax to hide video elements by targeting their CSS selectors, such as #video-container { display: none !important; }. This cosmetic filtering removes the visual tag from the page without blocking network requests or affecting audio playback. Properly formatted filters prevent invalid syntax errors and ensure a cleaner browsing experience.

Understanding Cosmetic Filtering in uBlock Origin

Cosmetic filtering is a core feature of uBlock Origin that allows users to hide specific HTML elements on a webpage based on their CSS selectors, IDs, classes, or attributes. Unlike standard content blocking, which prevents resources like scripts or images from loading, cosmetic filtering simply applies CSS rules to make elements invisible to the user. This is particularly useful for removing intrusive video players, pop-ups, or advertisement banners that you do not wish to see but do not necessarily need to block at the network level.

When you apply cosmetic filtering to exclude video tags, you are essentially telling the browser to set the display property of those elements to none. This approach is lightweight and does not interfere with the underlying functionality of the website, meaning that any background processes or audio streams associated with the video can continue to operate normally if required. It is important to distinguish this from dynamic filtering, which blocks HTTP requests entirely.

Creating Custom Filters for Video Tags

To apply cosmetic filtering effectively, you must identify the correct CSS selector for the video element you want to hide. You can use your browser’s developer tools to inspect the video tag and locate its unique ID, class, or other identifying attributes. Once identified, you can create a custom filter rule within uBlock Origin’s interface.

  1. Open the uBlock Origin dashboard by clicking the extension icon in your browser toolbar.
  2. Navigate to the My filters tab, which is located in the left-hand menu.
  3. Enter your custom filter rule in the text editor. The syntax follows the pattern: example.com##selector.
  4. For example, to hide a video container with the ID main-video on example.com, you would write: example.com##div#main-video.
  5. Click the Apply changes button at the top of the editor to save and activate your new filter.

This method gives you granular control over which videos are hidden on which sites. You can target multiple selectors by separating them with commas, such as example.com##.video-player, ##.ad-banner. This flexibility allows you to clean up complex layouts where video elements are nested within various containers.

Troubleshooting Invalid Syntax Errors

One common issue when creating custom filters is encountering invalid syntax errors. These errors typically occur when the filter rule is malformed, missing the site domain prefix, or using incorrect CSS syntax. uBlock Origin provides real-time validation in the My filters tab, highlighting errors in red so you can correct them immediately.

To avoid these errors, always include the domain name followed by two hash marks (##) before the CSS selector. For global filters that apply to all websites, you can omit the domain and use just ##selector, though this is generally discouraged for video tags as it may break legitimate content on unrelated sites. Additionally, ensure that your CSS selectors are valid and do not contain spaces unless they are part of a descendant selector.

If you suspect a filter is causing issues, you can temporarily disable it by commenting it out with a semicolon (; ) at the beginning of the line. This allows you to test whether the problem persists without permanently deleting the rule. Refer to our guide on Troubleshooting Hidden Elements with uBlock Origin on techsupport sites for more detailed steps on diagnosing filter-related problems.

Best Practices for Managing Video Filters

While hiding video elements can improve page aesthetics, it is essential to consider the impact on user experience. Some websites rely on video players for interactive content, tutorials, or media playback. Hiding these elements might render the page unusable or confusing for visitors. Therefore, it is recommended to apply cosmetic filters selectively and only to sites where the video content is truly unwanted or redundant.

You can also use wildcard characters in your selectors to target multiple similar elements. For instance, example.com##div[class*="video"] will hide any div containing "video" in its class name. However, use wildcards with caution, as overly broad selectors may inadvertently hide other content. Regularly review your custom filters to ensure they remain effective as websites update their HTML structures.

Performance Considerations

Cosmetic filtering has minimal impact on browser performance compared to blocking network requests. Since the resources are still loaded but simply hidden via CSS, there is no significant reduction in bandwidth usage. However, this approach ensures that the website’s layout remains intact, preventing issues like shifted content or broken designs that can occur when elements are removed dynamically. For users concerned about privacy or security, note that cosmetic filtering does not prevent data collection or tracking scripts embedded within the video player.

Frequently Asked Questions

Does hiding a video element stop the audio?

No, cosmetic filtering only changes the visual presentation of the element by applying CSS rules. The underlying media resource, including any audio tracks, continues to load and play in the background. If you wish to stop audio playback, you must block the network request itself or use additional scripting.

Can I use wildcards in my custom filters?

Yes, uBlock Origin supports wildcard characters like asterisks (*) and question marks (?) in CSS selectors. This allows you to match patterns across multiple elements, such as hiding all divs with classes starting with "ad-". However, use these carefully to avoid unintended side effects on legitimate content.

How do I find the correct CSS selector for a video?

Use your browser’s developer tools (usually accessible via F12 or right-click > Inspect) to hover over the video element. Look for the ID, class, or other attributes in the HTML structure. Copy the most specific identifier to ensure your filter targets only the desired element.

What happens if my filter breaks a website?

If a cosmetic filter causes layout issues or hides critical content, you can disable it by commenting it out with a semicolon in the My filters tab. Alternatively, you can remove the line entirely and click Apply changes to restore normal functionality.

Are there risks to using custom filters?

The primary risk is accidentally hiding important content or breaking website functionality due to overly broad selectors. There are no security risks associated with cosmetic filtering itself, as it does not execute code or modify data. Always test filters on a case-by-case basis to ensure compatibility.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More