Override Font tag

C

Chris

I have inherited a CMS system which allows users to format content
themselves. Much of the formatting is done using font tags. I want to be
able to convert some of the pages to be more accessible to disabled users.
Is there any I can do to override the font tag via css? I have been playing
around with the inherit feature but of css but IE 6 doesn't seem to
recognise it. Am I doing something wrong or is it not supported? Ideally I
want a solution that is v.4 upwards compatible. Any ideas, regards, Chris.
 
M

Martin Jay

Chris said:
I have inherited a CMS system which allows users to format content
themselves. Much of the formatting is done using font tags. I want to be
able to convert some of the pages to be more accessible to disabled users.
Is there any I can do to override the font tag via css? I have been playing
around with the inherit feature but of css but IE 6 doesn't seem to
recognise it. Am I doing something wrong or is it not supported? Ideally I
want a solution that is v.4 upwards compatible. Any ideas, regards, Chris.

An interesting problem.

The following displays "Hello there!" using the Arial font in red:

<p><font color="#FF0000" face="Arial">Hello there!</font></p>

Adding the following CSS overrides those settings and displays it in
green Verdana:

font{
font: Verdana;
color: Green;
}

So, perhaps you could explicitly set the font element so that it
displays how you want it to, maybe the same as the body element.

Or... Presumably the CMS content is stored in some sort of database.
Perhaps you could cleanse it of unwanted tags, or modify the script that
displays CMS entries to strips tags before they are sent to the browser.
 
T

Toby Inkster

Chris said:
I have inherited a CMS system which allows users to format content
themselves. Much of the formatting is done using font tags.

I'd use a bit of server-side processing to strip them out. If you're using
PHP there is a strip_tags() function which can strip out HTML from a
string. (You can provide a list of tags which it should leave alone.)
 
J

jojo

Chris said:
I have inherited a CMS system which allows users to format content
themselves. Much of the formatting is done using font tags. I want to be
able to convert some of the pages to be more accessible to disabled users.
Is there any I can do to override the font tag via css? I have been playing
around with the inherit feature but of css but IE 6 doesn't seem to
recognise it. Am I doing something wrong or is it not supported? Ideally I
want a solution that is v.4 upwards compatible. Any ideas, regards, Chris.
ASFAIK their is a order in which color, formats, font-style and so on
are used:

Specified by style-Attribut
Specified by font-tag
Specified in internal Stylesheets
Specified in external Stylesheets

To override any specification which is above in the list with any which
below add a !important to that style.
Example:

font{
font: Verdana;!important
color: Green;!important
}
 
A

Andy Dingley

jojo said:
ASFAIK their is a order in which color, formats, font-style and so on
are used:

There's no "order" in CSS. Instead there is a cascade, with specificity
rules and calculations. This needn't give rise to a simple linear order
in all cases, it's more complex than that.
Specified by style-Attribut
Specified by font-tag
Specified in internal Stylesheets
Specified in external Stylesheets

As you describe it here, <font> (and some other HTML presentational
information) gets treated as lower than the stylesheets too. A browser
can also ignore them entirely, should it wish to (i.e. a pure CSS
browser).

Here's the ref:
http://www.w3.org/TR/CSS21/cascade.html#q13

"The UA may choose to honor presentational attributes in an HTML source
document. If so, these attributes are translated to the corresponding
CSS rules with specificity equal to 0, and are treated as if they were
inserted at the start of the author style sheet."
 
J

jojo

Andy Dingley said:
There's no "order" in CSS. Instead there is a cascade, with specificity
rules and calculations. This needn't give rise to a simple linear order
in all cases, it's more complex than that.


As you describe it here, <font> (and some other HTML presentational
information) gets treated as lower than the stylesheets too. A browser
can also ignore them entirely, should it wish to (i.e. a pure CSS
browser).

Here's the ref:
http://www.w3.org/TR/CSS21/cascade.html#q13

"The UA may choose to honor presentational attributes in an HTML source
document. If so, these attributes are translated to the corresponding
CSS rules with specificity equal to 0, and are treated as if they were
inserted at the start of the author style sheet."

Thanks, I didn't know it exactly.
But still: if some css-layout is not used I would try to make it
!important...
 
A

Andy Dingley

jojo said:
Thanks, I didn't know it exactly.
But still: if some css-layout is not used I would try to make it
!important...

Why not sacrifice a chicken to it? (or shoot a bear)

If it's not working, then it's not working for a different reason.
Doing something inappropriate isn't going to change that.
 
J

jojo

Thanks, I didn't know it exactly.
Why not sacrifice a chicken to it? (or shoot a bear)

If it's not working, then it's not working for a different reason.
Doing something inappropriate isn't going to change that.
I cannot remember you had a different solution that works...
So Tell me if you found one or just don't post anything...
And if I remember correctly you said:
A browser can also ignore them entirely, should it wish to (i.e. a pure CSS
browser).

It *can* but it must not. So at least give !important a try, sometimes
it can move mountains (a german saying).
 
A

Andy Dingley

I cannot remember you had a different solution that works...

Of course. Simply use the CSS - it will over-ride <font> quite happily
without needing !important

If this doesn't work, then the fault is elsewhere. Fooling blindly with
!important won't fix it.
It *can* but it must not.

No, that's untrue. It may ignore them (RFC2119 applies). The "must not"
condition does not apply.
 
J

jojo

Andy Dingley said:
Of course. Simply use the CSS - it will over-ride <font> quite happily
without needing !important
I think *this* is exactly what Chris had tried, right?
 
A

Andy Dingley

I think *this* is exactly what Chris had tried, right?

"I have been playing around with the inherit feature [...] of css but IE
6 doesn't seem to recognise it."

So that's a No
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top