S P
S P

Reputation: 4643

Jquery / CSS Reset style

I'm building a login window using javascript (JQuery) which complies to very strict design guidelines; it exhaustively uses CSS-floats in order to position the screen elements. This javascript is hosted from a central location and implemented by ~1000 websites. It works very well, but there are some websites that have in their stylesheet something like this:

 img, div, input { 
       behavior: url("_include/website/js/iepngfix.htc") 
   } 

Problem is that such CSS-definitions disturbs the layout of my login window.

My javascript + css are loaded last. Is there a way I can tell in my Javascript / CSS to ignore all styles that have been loaded previously.

Upvotes: 4

Views: 2237

Answers (2)

fcalderan
fcalderan

Reputation:

Let's suppose your window has a container class e.g. mylogin then you could try to add in queue the following css

.mylogin img,
.mylogin div,
.mylogin input {
   behavior : url(data:null);
}

Upvotes: 2

Mayur
Mayur

Reputation: 3097

Method 1

Override styles defined in previous style sheets using !important property.

Method 2

If you are using jQuery in your code then you can clear these attributes on init() function. This will add advantage as you can still assign CSS attributes to tags in your CSS files.

$('img').css('padding', '0px');

Note: You might try using iframe for login page code. I haven't tried this but, I guess this might work.

Upvotes: 0

Related Questions