Advanced CSS Selectors and Drupal

Drupal can be difficult to override at times in terms of styling unless you place your intercepts in a submodule’s PHP so creative CSS knowledge and implementation is a must to keep your site from looking “too Drupaly”.

One CSS technique that I have been using a bit lately that you don’t usually run into in systems where the HTML is more easily customizable is the title attribute selector. Warning – this is really a hack. But I think that it deserves a place in any Drupal Developer’s toolkit.

The title attribute looks like this:


/*css stuff goes here*/


This selector targets hyperlinks (a) that have a title that contains the word Request (case sensitive too). This selector will add whatever you add in the following curly brackets. There are other options too. See the w3s link at the bottom.


The SS is really two SSs: one with the selector disabled so you see the element and one with it turned on. The element that needs to disappear is a link to the /user/password page. For whatever reason (this is Drupal and sometimes it takes so long to figure out the mystery that it becomes a Pyrrhic victory as the deadline is missed) this link will take you to a place where the UX sucks. The workaround is pretty easy though. Use the Password reset form and hide the link using CSS. But since the link has nothing special in its selectors that gets tough. So, use the title attribute selector. The green box in the SS is the form for passwords, BTW.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: