Take the 2-minute tour ×

I was given the task of doing a facelift to our current site. I am moderately well versed in CSS so I am converting the bazillion tags to CSS styles and deleting about 2 times that many that were simply not necessary.

It's all going well until I run into a certain product page that is only a wrapper into which other HTML files are pulled by a server.execute(filename) command. (we're using aspx for the wrapper page.)

There are almost 700 of these pages and they all are cursed with this and that. Past editors with FrontPage that only know how to drag pretty things on the screen.

Anyway, I am wondering if there is a way to use CSS in the wrapper page to override the tag behavior so I can make it something sane that fits with the rest of my pages. I'd even be open to something JavaScript that would remove the tags, but that's my less preferred solution. Thanks!

share|improve this question
add comment

5 Answers

up vote 11 down vote accepted
font[size="2"] {
   property: value !important;

The !important after property values is what you're looking for.

share|improve this answer
Very nice, but won't work with IE6 - still (sadly) worth noting. –  Pekka 웃 Mar 17 '10 at 20:39
Thanks for the answer I was looking for. I'll have to deal with IE6 swiftly and harshly (I wish). –  Deverill Mar 17 '10 at 20:41
This doesn't work for me in IE7. –  Pekka 웃 Mar 17 '10 at 20:44
I don't understand why, but I can't get this to work even in IE8. Am I just overlooking something? Anyone been successful? –  Pekka 웃 Mar 17 '10 at 20:48
@Pekka Works for me, are you using a doctype? –  James Goodwin Mar 17 '10 at 21:09
show 1 more comment

You can use the CSS attribute selector to match your font tag:

font[size="2"] {
    font-size: 12px;
    font-weight: bold;
share|improve this answer
Won't work with IE6 though. If the client is using font tags on their site this may be an issue. –  Pekka 웃 Mar 17 '10 at 20:38
Thanks James. +1 for the answer too. –  Deverill Mar 17 '10 at 20:42
add comment

A simple reset would do for this case, e.g.

font {
    font-size: 100%;
share|improve this answer
+1 very nice solution (if the OP doesn't need to give the size=2 a specific other size in exchange.) –  Pekka 웃 Mar 17 '10 at 20:50
@Pekka but the size attribute will override this. He needs an !important. –  Eli Grey Mar 17 '10 at 21:19
@Eli Grey: I beg to differ — pauldwaite.co.uk/test-pages/2465665 –  Paul D. Waite Mar 17 '10 at 23:40
Oh, sorry. My mistake. –  Eli Grey Mar 18 '10 at 2:11
“if the OP doesn't need to give the size=2 a specific other size in exchange” — Ah yes, this does assume he just wants to get rid of the effect of presentational tags entirely. Personally, I’d edit the pages, 700 isn’t that many. It’d be a bit boring, but a day or two of judicious find-and-replace in a decent text editor, and you could turn a dog’s breakfast into some decent code. –  Paul D. Waite Mar 18 '10 at 11:18
add comment

If you can - that means if you can ignore IE6 - use the CSS method Eli Grey and James Goodwin propose.

A cleaner, but more tedious way would be to do a intelligent search+replace changing all <font size='2'> to <span class='size_2'> or something. It would get you rid of the crappy code, and work in all browsers.

share|improve this answer
since we're doing the right thing, that 'size_2' would be better named as something semantic. To say nothing of the closing /font –  Adriano Varoli Piazza Mar 17 '10 at 20:45
@Adriano true re the class name. The closing font is why I'm saying "intelligent" search+replace - it would have to be a tool capable of recognizing and replacing tags. Dreamweaver used to have that feature, there are other tools around, too. –  Pekka 웃 Mar 17 '10 at 20:47
add comment

Since Internet Explorer ignores the !important rule, you could try a Javascript approach such as the following (uses jQuery) to replace all the FONT elements with SPANs and have the appropriate stylesheets to apply formatting.

  var fontFree = $('span');
share|improve this answer
add comment

Your Answer


