HighDots Forums  

Ignore style tags

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


Discuss Ignore style tags in the Cascading Style Sheets forum.



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

Default Ignore style tags - 12-10-2004 , 03:35 AM






I have a portion of text on a page that I want all inline styles to be
ignored. Is there a way to do this?

Thanks,

Kevin


Reply With Quote
  #2  
Old   
Chris Leipold
 
Posts: n/a

Default Re: Ignore style tags - 12-10-2004 , 03:41 AM






Hi,

ComputerSnack wrote:
Quote:
I have a portion of text on a page that I want all inline styles to be
ignored. Is there a way to do this?
Could you be more specific or post an example/URL?
Do you want the elements to be hidden or do you want them to be
displayed 'neutral'?

Chris


Reply With Quote
  #3  
Old   
ComputerSnack
 
Posts: n/a

Default Re: Ignore style tags - 12-10-2004 , 03:54 AM



Okay, I have a page that is dynamically generated from a database. One
of the database fields has a lot of misc. html and inline style tags in
it. Let's call this the "description" paragraph.

Right now, the description paragraph is formatted according to the
inline style tags, however, I want it to be formatted according to my
standard css that I have set for the rest of the page.

I was told that inline css tags overwrite anything else, however, I
guess I want to do the opposite, but only for this section. How do I do
it? Could it be with another inline tag?


Reply With Quote
  #4  
Old   
Chris Leipold
 
Posts: n/a

Default Re: Ignore style tags - 12-10-2004 , 04:30 AM



Hi,

Quote:
I was told that inline css tags overwrite anything else, however, I
guess I want to do the opposite, but only for this section. How do I do
it? Could it be with another inline tag?
No chance. You *can* put two style-Attributes in one Element but this is
no valid HTML and the results will be chaotic - depending on the browser.

If you get the Elements of a database, why don't you use a script (I
guess you use PHP and MySQL) to strip the inline-styles?

Chris


Reply With Quote
  #5  
Old   
Mark Tranchant
 
Posts: n/a

Default Re: Ignore style tags - 12-10-2004 , 05:26 AM



Chris Leipold wrote:
Quote:
Hi,

I was told that inline css tags overwrite anything else, however, I
guess I want to do the opposite, but only for this section. How do I do
it? Could it be with another inline tag?

No chance. You *can* put two style-Attributes in one Element but this is
no valid HTML and the results will be chaotic - depending on the browser.
You could, of course, overrule the existing property declarations within
the existing style attribute:

<p style="border: 1px solid red; border: none;">...</p> for example.

Alternatively, if *you* just want to see what it looks like, rather than
publishing the results, get Firefox and the Web Developers' Toolbar,
which features the ability to turn off all styles.

--
Mark.
http://tranchant.plus.com/


Reply With Quote
  #6  
Old   
Neal
 
Posts: n/a

Default Re: Ignore style tags - 12-10-2004 , 05:50 AM



On 10 Dec 2004 01:54:44 -0800, ComputerSnack <praegerk (AT) yahoo (DOT) com> wrote:

Quote:
Okay, I have a page that is dynamically generated from a database. One
of the database fields has a lot of misc. html and inline style tags in
it.
I would be remiss to fail to mention this: while you might have your hands
tied in this matter, this is about the worst way to implement this. There
is no means for removing style completely once it's applied - the best you
can do is replace it with some other style, which may or may not match the
particular UA's rendering defaults. It's a little like salting your soup.
You can always add a bit more, but you can't really take it out once it's
in there.

Therefore, the best way to implement what you're after is to send no CSS
with the data, and instead add the CSS only where you want it. The best
means based on what you have is to use a server script to remove all style
attributes from the included markup, and then add new CSS to it as you
require.


Reply With Quote
  #7  
Old   
ComputerSnack
 
Posts: n/a

Default Re: Ignore style tags - 12-11-2004 , 02:26 AM



Thanks for everyone's comments. I found a solution that worked
perfectly from a post at another forum. His solution was to use the
!important modifier. It worked great. It forced my css to overrite any
of the users inline or any other css. Here is a link to the thread:
http://www.htmlforums.com/showthread...threadid=50345


Here is the message. It's from htmlforums.com
-----


You might have some luck using the !important modifier. !important
designates a CSS rule as not overridable. You could probably do
something like:

..noCrappyOfficeFormatting * { font-size: 10pt !important;
color: #000 !important; }



Inserting, obviously, the rules you intend to use. The asterisk is a
wildcard selector, so it should catch everything inside any object with
the "noCrappyOfficeFormatting" class (or whatever you want to call it).

Rys

----

Neal wrote:
Quote:
On 10 Dec 2004 01:54:44 -0800, ComputerSnack <praegerk (AT) yahoo (DOT) com
wrote:

Okay, I have a page that is dynamically generated from a database.
One
of the database fields has a lot of misc. html and inline style
tags in
it.

I would be remiss to fail to mention this: while you might have your
hands
tied in this matter, this is about the worst way to implement this.
There
is no means for removing style completely once it's applied - the
best you
can do is replace it with some other style, which may or may not
match the
particular UA's rendering defaults. It's a little like salting your
soup.
You can always add a bit more, but you can't really take it out once
it's
in there.

Therefore, the best way to implement what you're after is to send no
CSS
with the data, and instead add the CSS only where you want it. The
best
means based on what you have is to use a server script to remove all
style
attributes from the included markup, and then add new CSS to it as
you
require.


Reply With Quote
  #8  
Old   
Michael Rozdoba
 
Posts: n/a

Default Re: Ignore style tags - 12-11-2004 , 02:16 PM



ComputerSnack wrote:
Quote:
Thanks for everyone's comments. I found a solution that worked
perfectly from a post at another forum. His solution was to use the
!important modifier. It worked great. It forced my css to overrite any
of the users inline or any other css. Here is a link to the thread:
http://www.htmlforums.com/showthread...threadid=50345


Here is the message. It's from htmlforums.com
-----


You might have some luck using the !important modifier. !important
designates a CSS rule as not overridable.
No it doesn't. See http://www.w3.org/TR/REC-CSS2/cascade.html

It might meet your requirements, however any user styles also marked
!important will take priority aiui.

--
Michael
m r o z a t u k g a t e w a y d o t n e t


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.