Styling links based on partial URLs with CSS

Sometimes you just want to style all the links pointing to a certain site, or containing a certain string in the URL. For example, styling all links to Wikipedia to stand out from regular links or hiding all links that include “registration” in the URL. It’s just a matter of using: href*= in the CSS selector.

a[href*="registration"] {
	display: none;
}

This example will hide all links with “registration” in the URL.

Posted in

Leave a Comment

Your email address will not be published. Required fields are marked *