3

I am working on bringing our company's web application into the 21st century and am trying to use some of the new CSS3 features like border-radius and box-shadow for a more modern visual effect. However, over 90% of our userbase is still on IE8, which doesn't support these options. CSS3 Pie seemed like the perfect solution, but I'm running into some odd problems.

Through some trial and error I have managed to get all of the CSS properties that I want to use working in IE8. Some examples of the classes used are:

    .pageTitle {
        border-radius: 12px;
        color:#fff;
        text-shadow: 1px 1px 0px #666;
        box-shadow: 5px 5px 3px #888888;

        background: -webkit-linear-gradient(blue, black); /* For Safari */
        background: -o-linear-gradient(blue, black); /* For Opera 11.1 to 12.0 */
        background: -moz-linear-gradient(blue, black); /* For Firefox 3.6 to 15 */
        background: linear-gradient(-0.5deg, black, blue); /* Standard syntax */
        -pie-background: linear-gradient(top, blue, black); /*ie 6-9 via PIE*/

        behavior: url(../../common/compatibility/PIE.htc);
    }

    .headerGradient {
        background: -webkit-linear-gradient(blue, black); /* For Safari */
        background: -o-linear-gradient(blue, black); /* For Opera 11.1 to 12.0 */
        background: -moz-linear-gradient(blue, black); /* For Firefox 3.6 to 15 */
        background: linear-gradient(-0.5deg, black, blue); /* Standard syntax */
        -pie-background: linear-gradient(top, blue, black); /*ie 6-9 via PIE*/
        behavior: url(../../common/compatibility/PIE.htc);
        position:relative;
    }

The first is used on a div at the top of the page with just a word or two of text inside. The second is used on the header of some of our display tables.

Occasionally, when I visit a page using these classes, the elements will simply not appear. It looks almost like the classes are being ignored (causing the elements to render with a white background), but the text within the elements should then show up in black and still be visible. It is not; I just see an open white space (though images inside these elements will still appear)

When this occurs I can cause the "pageTitle" div to appear correctly by simply moving my mouse over it. However, this does not work on the "headerGradient" (and similar) table heads. Refreshing the page sometimes resolves the issue, but it usually takes quite a bit of work to get CSS3 Pie to kick in again.

I cannot reproduce this issue on the CSS3 Pie website, nor have I seen it discussed elsewhere, so I think there may be something incorrect in my implementation. I would appreciate any thoughts.

UPDATE

By moving the pie files to my webroot, where the shell page of our application lives, some of these issues seem to have disappeared (though it's difficult to tell with a sporadic problem). However, there are still instances where headers will appear without styling until I move the mouse over them. All of my styles applied to CFLayoutAreas (ext-js tabs and accordions) are not working correctly:

        /* Controls the header of the cflayout accordions. */
        .x-accordion-hd {
            background: -webkit-linear-gradient(#9999ff, #333366); /* For Safari */
            background: -o-linear-gradient(#9999ff, #333366); /* For Opera 11.1 to 12.0 */
            background: -moz-linear-gradient(#9999ff, #333366); /* For Firefox 3.6 to 15 */
            background: linear-gradient(-0.5deg, #333366, #9999ff); /* Standard syntax */
            -pie-background: linear-gradient(top, #9999ff, #333366); /*ie 6-9 via PIE*/
            behavior: url(PIE.htc);
            position:relative;
        }

        .x-tab-strip,.x-tab-left,.x-tab-right {
            border-radius:5px 5px 0px 0px;

            background: -webkit-linear-gradient(#9999ff, #333366) !important; /* For Safari */
            background: -o-linear-gradient(#9999ff, #333366) !important; /* For Opera 11.1 to 12.0 */
            background: -moz-linear-gradient(#9999ff, #333366) !important; /* For Firefox 3.6 to 15 */
            background: linear-gradient(-0.5deg, #333366, #9999ff) !important; /* Standard syntax */
            -pie-background: linear-gradient(top, #9999ff, #333366) !important; /*ie 6-9 via PIE*/
            behavior: url(PIE.htc);
            position:relative;
        }

In fact, the tabs and tab bar disappear completely.

I would welcome any suggestions.

UPDATE 2

By moving the PIE include to the bottom of the page, most of the issues have disappeared. CFLayout still isn't playing nice, so I've simply disabled styling of the layout area itself using PIE.

My one remaining issue is that PIE doesn't seem to adjust itself accordingly for page updates. When our detail pages load there is a cfLayout in the center of the page and buttons styled with PIE at the bottom. The buttons appear correctly on page load, while the cfLayout is still invisible. Then the cfLayout appears and pushes the buttons down the page. Sometimes, however, the PIE styling for the buttons will remain where they loaded instead of moving down the page with the buttons themselves.

Is there any way to call PIE to force a position update based on the parent element's current position?.

Nicholas
  • 1,974
  • 4
  • 20
  • 46
  • Any way we can get a demo that shows the sporadic behavior? – Zach Saucier Dec 26 '13 at 14:28
  • @ZachSaucier Thanks for the comment. I'm not sure if I can reproduce it very easily, but I will try to put something together today. – Nicholas Dec 26 '13 at 15:27
  • @ZachSaucier I'm sorry; I won't be able to post this today. I have created a simpler example page based off our live site, but will need to find server space for it and get approval to post it, which may not happen until next week. – Nicholas Dec 26 '13 at 20:30
  • It's quite fine, it will just help you get an answer faster – Zach Saucier Dec 26 '13 at 20:35
  • Did you look at the known issues: http://css3pie.com/documentation/known-issues/ -- I could never get this to work, but then I figured most people using IE8 don't see rounded corners. Gradients already have IE8 support if you use the filter. Rounded corners, oh well. Anyway, in the Pie forum did you try adding: position:relative; z-index: 0; to the stuff that's weirding out? – Christina Dec 27 '13 at 03:42
  • @cab I did try the relative positioning workaround, but missed the z-index. I tried that today and it did not help. Though I did notice that if I open up the developer tools and change (check/uncheck or modify) some of the relevant classes or styles PIE would immediately begin working on that element. I noticed PIE stuff loads after the page; could my page be taking too long to load causing PIE to load before (and thus behind) the actual elements? – Nicholas Dec 27 '13 at 14:14
  • 1
    Yes. The scripts load faster if you load before the body closing tag, but I've noticed that my conditional scripts for IE load before the ones in the footer of the doc, try loading pie there, after the other scripts. – Christina Dec 27 '13 at 15:36
  • @cab I just moved the stylesheet that defines PIE related items to the bottom of the page and ran a few tests. They worked fine, but as this is a sporadic issue only time will tell. In any case, excellent suggestion :). However, this still leaves the trouble with the cfLayout tab strips disappearing; any thoughts on that? – Nicholas Dec 27 '13 at 17:11
  • Without seeing the code, IE8 disappearing list items usually gets fixed by adding a position relative on the ul or the wrapper, or both. If that doesn't work, keep it on there and fiddle with the z-index. Then re-check in good browsers or use IE8 css hacks. – Christina Dec 27 '13 at 17:16
  • Also read this for other crap you might encounter: http://believeinmiraclesx.wordpress.com/2012/08/16/ie8-images-disappear-when-placed-inside-a-floatleft-container/ – Christina Dec 27 '13 at 17:20
  • Make sure you have the html5 shiv in your code and that it's loading (google is not always up). I host it locally with my modernizer build. Read this: http://stackoverflow.com/questions/16288503/header-disappears-and-lists-become-unstyled-in-ie-8-and-below – Christina Dec 27 '13 at 17:21
  • If the disappearing items are being styled by css loaded by a script, load that script in the head after jQuery. I noticed two scripts didn't apply styles in my work in IE8 and when I loaded scripts in the head, they worked again. I have my jQuery lib loading in the head but all others in the footer, however two scripts that require fallbacks applied by the script need to be loaded in the head – Christina Dec 27 '13 at 17:27
  • Thank you for all the suggestions. I will try moving the scripts around to see if that resolves anything, but for stability's sake I may just end up disabling this part of the styling in IE. Besides this, I think most of my problems are a result of timing. I just noticed that cfLayout tabs loaded after page load don't apply styling correctly; I wonder if PIE could occasionally 'reload' itself to try and combat this. – Nicholas Dec 27 '13 at 17:48
  • @cab Could you please add your thoughts, especially about moving the CSS include to the bottom of the page, as an answer? – Nicholas Dec 30 '13 at 13:42
  • "I am working on bringing our company's web application into the 21st century" God. You're 14 years late. "However, over 90% of our userbase is still on IE8" God! They're 30 years late. (to ditch MS and go Apple) – bjb568 Dec 30 '13 at 17:56
  • @Dude Unfortunately, our website was designed specifically for IE8 (before I got here) so we forced our clients to use it until now. I've been pushing for standards compliance and updated styling, but it's not always easy to justify the business case. I think a lot of companies are, unfortunately, in this same situation. – Nicholas Dec 30 '13 at 18:18
  • @Nicholas Hopefully the big fat companies that can't switch from the dip-switch-programmed computers will die off soon. – bjb568 Dec 30 '13 at 20:09
  • @Nicholas - well it won't be an answer unless it worked. What's up with the disappearing stuff? – Christina Dec 31 '13 at 02:40
  • @cab Your suggestion of moving the stylesheet to the end did work for the sporadic 'invisible element' problem. I feel that the remaining issue is an incompatibility with cfLayout and have decided to instead simply disable styling for those elements in IE (as much as I hate resorting to browser detection). So I feel like this question is reasonably resolved, though I'd still love a way to 'refresh' PIE positioning via JS. – Nicholas Dec 31 '13 at 13:57
  • Eh, @cab - please forgive my audacity, but locking up information like this in comments is really not very good; it's hard for others to find amid this long thread, can't be searched for, can't easily be edited for improvements or if links break, and may be hidden or deleted without warning. I've moved the meat of your comments into an answer and assigned it to you; feel free to remove it if you must, but please consider its potential value to future readers first. – Shog9 Jan 04 '14 at 02:46
  • No problem. But it wasn't an "answer" imo, just suggestions since I didn't see the html – Christina Jan 04 '14 at 03:13

1 Answers1

4

If the disappearing items are being styled by css loaded by a script, load that script in the head after jQuery. I noticed two scripts didn't apply styles in my work in IE8 and when I loaded scripts in the head, they worked again. I have my jQuery lib loading in the head but all others in the footer, however two scripts that require fallbacks applied by the script need to be loaded in the head.

Without seeing the code, IE8 disappearing list items usually gets fixed by adding a position relative on the ul or the wrapper, or both. If that doesn't work, keep it on there and fiddle with the z-index. Then re-check in good browsers or use IE8 CSS hacks.

Some other ideas to try:

  • Make sure you have the html5 shiv in your code and that it's loading (google is not always up). I host it locally with my modernizer build. Read this: Header disappears and lists become unstyled in IE 8 and below

  • If the disappearing items are being styled by css loaded by a script, load that script in the head after jQuery. I noticed two scripts didn't apply styles in my work in IE8 and when I loaded scripts in the head, they worked again. I have my jQuery lib loading in the head but all others in the footer, however two scripts that require fallbacks applied by the script need to be loaded in the head.

Community
  • 1
  • 1
Christina
  • 34,296
  • 17
  • 83
  • 119
  • 1
    Whether it was meant as an answer or not, it resolved the original issue, and thus is deserving of the original bounty :). With some help I've recreated the bounty and will award it to this answer as soon as I am able. – Nicholas Jan 06 '14 at 17:30
  • @Nicholas For future reference, you can award a bounty to an answer directly. No need to reassign a bounty to the question. See [**Can I award a bounty to an old answer?**](http://meta.stackexchange.com/questions/16065/how-does-the-bounty-system-work) – JSuar Jan 06 '14 at 18:05