Question

Is there any way to disable one CSS property value only? For example, with the property 'text-decoration' there are possible values of none, underline, overline, line-through, blink and inherit.

I would like to allow all values of text-decoration with the exception of underline on ALL elements.

The pages I'm working with are dynamically generated, and can have content from all over the web- so it's not possible to target any specific element. Using text decoration 'none' works of course, but it blows away all other values as well :(

Suggestions?

Was it helpful?

Solution

There's no way to do this with just CSS and HTML. What you'd need is something like a property selector to target all of the elements on your page with text-decoration set to underline, but such a thing doesn't exist right now.

However, if JavaScript is an option, then you could accomplish this. You would first determine the style of the elements and then, if you needed to, set the style to get rid of the underline.

OTHER TIPS

Since there's no such thing as property selectors in Javascript and neither JQuery, You should get all of possible elements and then check for their css property and change it if needed. Something like this: $('*').each(function() { if ($(this).css('PROPERTY') == 'FORBIDDEN-VALUE') { $(this).css('PROPERTY', 'REPLACE-VALUE'); } });

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top