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

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

[email protected]

HostMySite.com

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.