Jump to content

CSS Declaration To CANCEL a Previous Declaration


mtorbin

Recommended Posts

Hey all,

 

I don't know if this is possible but I want to know if there's a declaration that I can call to CANCEL a previously declared style.  Consider the following:

 

At some point in my page, I have something like this (fictional example):

<style type="text/css">.myStyle{background-color:#ff0000; width:500px;}</style>

 

Later on, I want to REMOVE the width declaration (not patch over it, I know how to do that) so that the only active declaration is the background-color.  Is this possible?

 

Thanks,

 

- MT

Link to comment
Share on other sites

You could create a second style with the same settings minus the width, such as

 

<style type="text/css">
.myStyle{background-color:#ff0000; width:500px;}
.myStyleExpanded{background-color:#ff0000;}
</style>

 

Then use javascript to update the objects style classname. Not sure if that will suffice for what you are trying to do,but its one approach

 

 

Joe Ceresini

Network Engineer

jceresini@hostmysite.com

HostMySite.com

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.