Dynamically loaded css doesn't apply to dynamically loaded js views in IE8 - css

I am pretty much worried to make a duplicate with this question while more than on hour seems to be too much for navigating for the answer.
The situation is:
Widget, which needs to load css dynamically
Sammy.js and .ejs for views - most of all the html content is loaded dynamically
Lab.js to load javascripts
one loaded styles should apply to all the new content which instantly appears on the page
I've already tried the answers from these related posts:
dynamic CSS loading in IE won't work
Dynamically changing stylesheet path not working in IE and Firefox
(..and others)
The only thing which works for me even in the modern browsers is the injection of the "style" node with the inline styles inside. But this doesn't work in IE8 :( I do see the style node in the Developer Tools, but they do not apply. I've also tried to wait until the stylesheet is applied before starting the sammy.js application.
I would really appreciate your answer or a link to the related question and working answer.
P.S. I fix IE8 now, but IE7 working is also in the plan.

Did you try using createStyleSheet instead?
Or you could serve IE styleSheet.cssText instead of createTextNode.

Related

Added CSS style not disappearing on reload in Chrome developer tools

I am working on some front end design, and while fiddling with some stuff in Chrome developer tools I added the following to the webpage I am working on:
Even after reloading (and emptying cache and hard reloading) this style persists, regardless of whether or not I have the developer tools open.
I am not sure where this style is coming from or why it refuses to quit!
Has anyone experience something similar and were able to figure out a solution?
EDIT: If it matters this is being applied to a table element
Only two options really: either you defined the width: 100% as an inline style or it's being added via JS as an inline style.

CSS loads in IE7, but is displayed as no CSS

I got a problem on my Website http://achensee.info/ when loading in IE7.
At first, everything works perfect, and you can see the correct styles for the header and some HTML elements. However, after the main stylesheet and a little time later, IE7 strips all styles from the Website and displays it without CSS.
So, the files are loaded, but applied. Is this a common problem, or is there a way to fix this?
Could it be that too many styles cause the IE7 to crash the CSS view?
Thanks for your help and greetings from Austria :)
The problem is your call to the ie8.js file. It uses an AJAX call to your CSS files to reapply all styles, but its probably broken (as it never got past beta stage and was last touched in April of 2010).

IE8 not applying CSS altough files are loaded and classes added to DOM objects

I'm having some trouble with our precious Internet Explorer 8. We are working on a CMS for hotels and everything was just fine until awhile back, when IE8 stopped rendering the frontend properly. This is the public website demo and the top navigation as well as the menustrip are messed up in IE8. Same with the "Payment methods" in the right side of the footer, where small icons for accepted payment methods should have been shown.
The thing is, we do have a special CSS file dealing with IE issues and it's loaded on the website, but it's not being applied to elements by IE. Also, on my local machine other CSS files (not conditional) are being loaded in IE, but the browser doesn't apply the styles.
It's like this:
the CSS file is loaded
the classes are applied to the tags
but the styles are not applied to those classes (!)
Now this behaviour happens on some pages and doesn't happen on others (very few). For example, on this page the menustrip is ok. I read about similar issues in IE isn't rendering the CSS and js dom injected elements don't pick up CSS styling in IE. The thing is this behaviour has been reproduced on other PC's in the office, as well as at home. I'm quite baffled by this.
Has anyone else experienced similar issues? If so, did you fix it? How did you manage to fix it? Thanks to all!

CSS not working in IE8, while working fine in IE9

basically a majority of the CSS styles defined for my website are not displayed when opening the page in IE8. This is not only happening for my custom styles (which I load separately through a custom css file), but also for the built-in features of Rockettheme IONOSPHERE template, for example the box1/2/3/4/5/6 module styles. Also, the rounded style is not rendered, and all modules are shown with sharp corners instead.
I am also using a custom css file (called ralph_golfanatics.css), which I load inside the index.php as follows:
$gantry->addStyles(array('template.css','joomla.css', 'ralph_golfanatics.css'));
All custom styles of this file are displayed fine in IE9, but the most important styles are not shown in IE8. Simply adding these css-styles manually in the file template_ie8.css (that file comes with the Ionosphere template package) did not change anything.
Looking forward to receive any help in this matter. The webpage is http://www.golfanatics.de
Thank you all in advance for your hints.
Ralph
Unfortunately, the link you've included isn't working so it's difficult to pin down exactly what the problem is.
If you're referring to rounded borders displaying with sharp corners this is because border-radius is a CSS3 property which is not supported in IE8.
See this link for border-radius browser support.
There are many CSS3 properties which don't work in older browsers; this is expected behavior and most web developers work around this by using either 'progressive enhancement' or 'graceful degradation'. See this link for more information.
Most websites using CSS3 techniques will never look the same in every browser.

images that are not used in CSS files

what happens to them? are they loaded by the browsers?
should I split my CSS files into more stylesheets, so only images the css/images that are used are loaded on the page?
Seeing as people are saying the same thing I said in my comment I guess I should have added it as an answer.
I was going to recommend firebug, but I believe the images are not downloaded until you reference them in the html. You can confirm this using chrome or ie or firebug developer tools. as far as splitting the css, I would only do so if you have an excessively large css file, or you need to split it up for different css files for browser capability i.e. you have styles that are ie7 or ie 8 specific
Browsers will only download images that are actually used on the page. So images that are specified in CSS as background images will not be downloaded unless that CSS rule is applied on the page.
You can use Firebug or other similar programs to see what is loaded by the browser; however, I believe the answer is that since the DOM element is never created, the image is never requested from the server. No bandwidth or loading time is wasted (other than a few more bytes of CSS, but that shouldn't be too much overhead.)

Resources