HighDots Forums  

Can you set CSS to override font tags?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Can you set CSS to override font tags? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Nathan
 
Posts: n/a

Default Can you set CSS to override font tags? - 08-17-2004 , 01:26 AM






We have a content management system which allows our users to enter
html into pages on the site but they often just paste in from Word and
fill the site with word and html tags.

Our content management system will attempt to clean the code but
leaves some tags like the font tag untouched. Ideally the management
system would allow us to filter all tags we don't want out. But is
there anything in CSS which may also help to override font tags and
other html tags users inadvertently add to the site?

Thanks
Nathan

Reply With Quote
  #2  
Old   
Stephen Poley
 
Posts: n/a

Default Re: Can you set CSS to override font tags? - 08-17-2004 , 01:57 AM






On 16 Aug 2004 22:26:51 -0700, frnkln_nthn (AT) yahoo (DOT) co.uk (Nathan) wrote:

Quote:
We have a content management system which allows our users to enter
html into pages on the site but they often just paste in from Word and
fill the site with word and html tags.

Our content management system will attempt to clean the code but
leaves some tags like the font tag untouched. Ideally the management
system would allow us to filter all tags we don't want out. But is
there anything in CSS which may also help to override font tags and
other html tags users inadvertently add to the site?
If you check the CSS spec section 6.4.4, you'll see that there is
provision for allowing CSS to override FONT elements etc. However in
previous discussions I think it has been said that browsers are not very
reliable in this area. Faced with unpredictable versions of tag soup, I
think you'd be better off fixing the problem (i.e. the CMS) rather than
trying to patch over the symptoms. Failing this (because the supplier
has gone bust or refuses to fix the problem) you could try something
like a small Perl front-end which will strip all tags except for a few
in a "whitelist".

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/


Reply With Quote
  #3  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Can you set CSS to override font tags? - 08-17-2004 , 03:21 AM



Stephen Poley <sbpoleySpicedHamTrap (AT) xs4all (DOT) nl> wrote:

Quote:
If you check the CSS spec section 6.4.4, you'll see that there is
provision for allowing CSS to override FONT elements etc.
The way I see it, it says that CSS enabled browsers _must_ honor (in the
usual sense - there might be overriding rules in user style sheets, etc.)
CSS rules if they apply to FONT elements. But contrary to what people
seem to think fairly often, just setting font properties for the body
element for example won't do that. You need to use selectors that match
the font element (such as font, the name of the element, or *, the
universal selector) itself.

font { font-family: inherit;
font-size: inherit;
color: inherit;
font-weight: inherit; }

_should_ nullify the effect of font tags, by the specification. (The last
declaration is mostly theoretic: it nullifies the proprietary font-weight
attribute recognized by Netscape 4 [only, I think].)

Quote:
However in
previous discussions I think it has been said that browsers are not
very reliable in this area.
The main problem is that the value inherit is poorly supported, counting
by popularity of browsers. On Mozilla the above works fine, on IE not at
all. And there is in general no workaround - the value inherit has just
the meaning we want here, and there is no general substitute. For
the font size, however, we can use font-size: 100%. We could set
font-weight: normal, but that's not the same as inherit. More
importantly, we can set color: black but it then naturally makes the
color black even if the page's overall text color is different (e.g. due
to browser settings). And for font-family, what could we do?

Quote:
Faced with unpredictable versions of tag
soup, I think you'd be better off fixing the problem (i.e. the CMS)
rather than trying to patch over the symptoms.
Indeed. And allowing arbitrary tags (including browser-specific
monstrosities) creates unpredictable problems. So the positive approach
of permitted some repertoire of markup and throwing away the rest is
best.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.