user710502
user710502

Reputation: 11469

How to remove the css class

I have a piece of code that is wrapped in a css class, the problem is that there is one particular line there that needs to be in the <span> but does not need the css class. How can I tell it to not take that css? for that line

<span id="myPrice" class="Price" runat="server">  
    <uc:CustomMessage ID="mPrice" MessageKey="myMsg" runat="server" /> //does not need css
    <span ><asp:Literal ID="litPrice" runat="server" /></span>
</span>

So as you can see the second line, we dont want the css applied to it.. but it needs to be within that "myPrice" span.

Is there a way to achieve this?

Thank you

Upvotes: 1

Views: 266

Answers (3)

dtrejogo
dtrejogo

Reputation: 251

Can you apply the css rule just to the first line ?

#myPrice #mPrice { your rule }

Upvotes: 0

James Johnson
James Johnson

Reputation: 46077

From a design standpoint it would be better to move the styling to the inner <span> instead, but if that's not possible you could probably exclude it like this:

.Price:not(input[type="button"]) { color:red; }

The above excludes buttons, but you can replace this with whatever element you need. Here's a more detailed reference:

http://kilianvalkhof.com/2008/css-xhtml/the-css3-not-selector/

Upvotes: 1

wsanville
wsanville

Reputation: 37516

Give your user control its own CSS class, and specify rules that undo the effect of Price.

<uc:CustomMessage CssClass="noStyles" ID="mPrice" MessageKey="myMsg" runat="server" />

Then, have a rule called noStyles that undoes any effects of Price.

Upvotes: 0

Related Questions