Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





  Last Thread  Next Thread
Author
Thread Post New Thread   

Can you set CSS to override font tags?
 

Nathan




quote this post edit post

IP Loged report this post

Old Post  08-22-04 - 04:15 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


Post Follow-Up to this message ]
Re: Can you set CSS to override font tags?
 

Stephen Poley




quote this post edit post

IP Loged report this post

Old Post  08-22-04 - 04:15 AM  
On 16 Aug 2004 22:26:51 -0700, frnkln_nthn@yahoo.co.uk (Nathan) wrote:

>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/


Post Follow-Up to this message ]
Re: Can you set CSS to override font tags?
 

Jukka K. Korpela




quote this post edit post

IP Loged report this post

Old Post  08-22-04 - 04:15 AM  
Stephen Poley <sbpoleySpicedHamTrap@xs4all.nl> wrote:

> 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].)

> 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?

> 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/


Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 04:10 PM. Post New Thread   
  Previous Last Thread   Next Thread next
Stylesheets archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top