ignore style

G

Giorgio

Hi,
inside an Access db I've a lot of records with html text (like <p
style="color:red">, <font color="green">, ...) but I'd like to ignore the
style given to each text and use my css to show these texts.

Could you help me please?
 
B

Bob Barrows

Giorgio said:
Hi,
inside an Access db I've a lot of records with html text (like <p
style="color:red">, <font color="green">, ...) but I'd like to ignore
the style given to each text and use my css to show these texts.

Could you help me please?

You could try and strip those inline styles out before writing the tags
to Response ... probably not an easy task.
 
D

Dooza

Giorgio said:
Hi,
inside an Access db I've a lot of records with html text (like <p
style="color:red">, <font color="green">, ...) but I'd like to ignore the
style given to each text and use my css to show these texts.

Could you help me please?

As Bob said, due to the cascading nature of style sheets, when you apply
style directly to an element that is the style that is used. You *might*
be able to get around it by using !important in the style sheet after
every single style declaration:

p {
font-color:red!important;
}

Your best bet is to prevent them going into the database in the first place.

Steve
 
J

JM

inside an Access db I've a lot of records with html text (like <p
style="color:red">, <font color="green">, ...) but I'd like to ignore the
style given to each text and use my css to show these texts.

You're either going to have to strip out the inline styles as someone else
has already suggested, or do one of the following:

Either make sure the tags in question have either ID or class selectors and
then flag them as !Important or, simply create a new style for the <p>
element..

<p style="color:red">
<p class="mycolor" style="color:red">
<p id="acolor" style="color:red">

<style>
.mycolor{ /* class selector */
color: blue !Important;
}
#acolor{ /* ID selector */
color: blue !Important;
}
p{ /* element would be easiest */
color: blue !Important;
}
</style>

Any one of which should turn the paragraph text blue - even if it has
an inline style that specifies a red font.

Inline styles have a specificity of 1000 which basically means that it
will always take precedence with one exception. You guessed it - it's
all about being !Important

John
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top