Forums
View unanswered posts | View active topics It is currently Tue Aug 19, 2014 10:52 pm



Reply to topic  [ 7 posts ] 
 looking for work around when using !important on background 
Author Message

Joined: Wed Oct 13, 2010 2:05 pm
Posts: 7
Post looking for work around when using !important on background
Hello,

I have set up the htc and have working across my project. However we have a requirement to allow our clients to customize their theme (assorted page elements across the site). The css that they use to overwrite their theme is a subset of the overall style sheet, and we currently use background-color: new color !importnant to gaurentee the color overrides correctly.

I understand pie.htc cant handle this. So I am looking looking for any solution where I can override the color once its be defined by the initial stsyle sheet.


Wed Oct 13, 2010 2:10 pm
Profile

Joined: Wed Jul 14, 2010 11:46 am
Posts: 1441
Post Re: looking for work around when using !important on backgro
Help me understand your situation a little more. Are your PIE'd styles that you want to override using the normal CSS background properties, or -pie-background?

If the former, then I think the !important override should get picked up just fine.
If the latter, I'm not sure if IE honors !important in unrecognized property values or not. It's very possible not, in which case I don't think there's anything PIE can do about it. Can you just make sure the override rule has a selector with higher specificity?


Wed Oct 13, 2010 3:24 pm
Profile

Joined: Wed Oct 13, 2010 2:05 pm
Posts: 7
Post Re: looking for work around when using !important on backgro
we are using

.navBar { background-color: #f00; }

in our global style sheet

than for clients that wasnt to customize the colors to their corporate colors we use a second css file. The custom stylesheet would have

.navBar { background-color: #0f0 !important; }

what happens is the div no longer has the curved look. you can see all the divs added, but all now have the !important override color as the background.

Currently we are using pie for non customized elements and jquery corners for the elements that need to be customized.


Mon Oct 18, 2010 1:15 pm
Profile

Joined: Thu Oct 21, 2010 12:42 pm
Posts: 2
Post Re: looking for work around when using !important on backgro
jwbworks wrote:
what happens is the div no longer has the curved look. you can see all the divs added, but all now have the !important override color as the background.

I am seeing the exact same behavior. The !important on the background color causes pie to not do the border-radius on the same element.

Is there a workaround?


Thu Oct 21, 2010 12:44 pm
Profile

Joined: Wed Jul 14, 2010 11:46 am
Posts: 1441
Post Re: looking for work around when using !important on backgro
I think I see what's going on. Can you try the following please:

In your PIE_uncompressed.htc, find the following:

Code:
hideBackground: function() {
        var rs = this.targetElement.runtimeStyle;
        rs.backgroundImage = 'url(about:blank)'; //ensures the background area reacts to mouse events
        rs.backgroundColor = 'transparent';
}


Change it to add !important in the backgroundImage and backgroundColor styles:

Code:
hideBackground: function() {
        var rs = this.targetElement.runtimeStyle;
        rs.backgroundImage = 'url(about:blank) !important'; //ensures the background area reacts to mouse events
        rs.backgroundColor = 'transparent !important';
}


This should hopefully give it higher importance than your authors' !important style. Let me know if that works.


Fri Oct 22, 2010 10:59 am
Profile

Joined: Thu Oct 21, 2010 12:42 pm
Posts: 2
Post Re: looking for work around when using !important on backgro
That did not work. IE says "invalid argument".


Sat Oct 23, 2010 2:22 pm
Profile

Joined: Wed Jul 14, 2010 11:46 am
Posts: 1441
Post Re: looking for work around when using !important on backgro
Hmm, nuts. :|

I've opened this problem as issue http://github.com/lojjic/PIE/issues/issue/81 and will look into it further when I have a chance.

In the meantime, is it possible for you to simply use a selector with higher specificity in your clients' CSS? Or rely on the client CSS being loaded later so it takes precedence?


Sat Oct 23, 2010 7:49 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.