简体   繁体   中英

How do I prevent jQuery from resetting all my CSS?

I have a web application made in ASP.Net. Well, I have a few jquery server controls I made. Well, I just now started to bother with getting a "proper" jquery running with a theme and everything. So I replaced my old default jquery theme with a custom one and such and now everything is completely different.

From firebug it says that everything I assign just about is getting reset by .ui-helper-reset inside of jquery. How do I prevent this from happening? I would like to be able to set like font-size and such as the <body> level and not have to worry about it for each individual element, but it seems to reset the font size to something much larger than I use. the computed font-height is 17px!

I'm not understanding why it would do a CSS reset on each individual element that I add with jquery...

Edit: Ok, I just figured out some silly mistake for why my site "was" working. Well, I didn't include the theme's style sheet in the page. Now I have it included and thus I have the problems. But my problem still stands. I don't understand why the CSS Reset is happening on each element.

Just a wild guess ... How about applying your css AFTER it has been reset with jquery? Perhaps with:

$(document).ready(function() {  
    var mycss = document.createElement("link");
    $(mycss).attr("rel", "stylesheet").attr("type", "text/css").attr("href", 'your-css-filename');
});

If $(document).ready is still early, you can put the code inside a function and call it with setTimeout() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM