473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Ignore style tags

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

Jul 21 '05 #1
7 11251
Hi,

ComputerSnack wrote:
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
Jul 21 '05 #2
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?

Jul 21 '05 #3
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.

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
Jul 21 '05 #4
Chris Leipold wrote:
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/
Jul 21 '05 #5
On 10 Dec 2004 01:54:44 -0800, ComputerSnack <pr******@yahoo.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.
Jul 21 '05 #6
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:
On 10 Dec 2004 01:54:44 -0800, ComputerSnack <pr******@yahoo.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.


Jul 21 '05 #7
ComputerSnack wrote:
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
Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: chotiwallah | last post by:
i have a little database driven content managment system. people can load up html-docs. some of them use ms word as their html-editor, which resultes in loads of "class" and "style" attributes -...
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
1
by: Greg | last post by:
The following code works fine on Mozilla but generates an error* on IE, when the button calling the function is pressed and the slideshow is either on the first slide or last slide. * I can't...
6
by: Kevin G. | last post by:
I'm not sure if this is possible, but if a page uses a CSS style sheet and you would still like to use good old <font> tags... is there a tag to tell the browser to ignore the CSS formatting just...
3
by: Rob Nicholson | last post by:
This is a question about the following KB article: http://support.microsoft.com/kb/q262161 We've got a problem with the Infragistics NetAdvantage presentation controls which they've suggested...
7
by: Rob Nicholson | last post by:
We're using a well known presentation layer library to implement complex controls on an intranet site. IE has the following limitation which effectively means that you can only have 30 <STYLE> tags...
2
by: Brian Bischof | last post by:
To get my formatting to work with Firefox and IE browsers, I have to be very careful about the layout. So I'm removing all the Style tags that set the Height and Width values (and some of these...
0
by: suridcs | last post by:
Hi guys, i want to perform one operation like i am developing a control to compare 2 documents of any format. If i am comparing 2 HTML documents all the HTML tags are appearing in the comparision...
2
by: gregmcmullinjr | last post by:
I am wondering if there is a way to use a DTD or Schema to instruct an XML parser to ignore tags that are not defined. That is, if my list of acceptable tags is <bodyand <content>, then in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.