13

I know there is a CSS fallback for calc() for IE6-7. Likewise, I know there is a jQuery alternative.

However, is there a CSS-only fallback for calc() for IE8? If so, what is it?

Community
  • 1
  • 1
Derek Henderson
  • 9,388
  • 4
  • 42
  • 71
  • 2
    No. there is not. You could anyway work it out using js expressions. – Kees Sonnema Jun 14 '13 at 12:34
  • 2
    The only CSS fallback is to set a fixed width/height before the calc() – koningdavid Jun 14 '13 at 12:38
  • You would need to modify HTML, adding one extra (neutral container to increase or decrease value (positive or negative margin for instance), for other situation i don't think of, i have no idea. – G-Cyrillus Jun 14 '13 at 12:45
  • @GCyrillus, in other words, no, there isn't a CSS-only solution. ;) – Derek Henderson Jun 14 '13 at 12:47
  • it was already said , wasn'it ? if you drop expression and js and css , it might still be a turn around for IE8, that was my point :) – G-Cyrillus Jun 14 '13 at 12:49
  • You could use a Javascript polyfill like [this one](https://github.com/CJKay/PolyCalc/blob/master/polycalc.js). Yes, that might be a JS solution, but it would allow you to use the standard CSS code. (note: I haven't actually tried that polyfill script yet; just found it on google now) – Spudley Jun 14 '13 at 13:08
  • @Spudley, thanks for the suggestion. It seemed promising, but it didn't work when I tried it. (Edit: Ah, it requires CSSParser. Shame.) – Derek Henderson Jun 14 '13 at 13:21
  • @DerekHenderson - that's a pity. As I said, I hadn't tried it, but it looked like it would be useful. – Spudley Jun 14 '13 at 13:26
  • Maybe this can help: http://stackoverflow.com/questions/17108573/is-there-a-css-only-fallback-for-calc-for-ie8 – mayrop Jan 02 '14 at 22:54
  • 3
    @lachore, that's a bit recursive, don't you think, pasting a link in a question back to that very same question? – Derek Henderson Jan 06 '14 at 13:26

2 Answers2

7

You can do like this

.content{
    padding-right: 500px;
    width: 100%;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

DEMO http://jsfiddle.net/FYB4q/

Mo.
  • 26,306
  • 36
  • 159
  • 225
  • What does that have to do with the question? – Olly Hodgson Mar 17 '14 at 15:22
  • @OllyHodgson Calc is commonly used to combine percentages with pixel values, which was what I was trying to do. http://stackoverflow.com/questions/2434602/css-setting-width-height-as-percentage-minus-pixels – Ultimate Gobblement Sep 15 '14 at 09:49
  • This is a complete copy from the answer of the linked question: http://stackoverflow.com/a/18570513/651170 – deathlock Jun 15 '16 at 04:16
  • @deathlock I can't see much similarity with the answers. I would suggest to report "duplicate" threfore reputed members can review your suggestion – Mo. Jun 17 '16 at 08:21
2

There is no support dynamic properties above IE 8

Dynamic properties (also called "CSS expressions") are no longer supported in Internet Explorer 8 and later, in IE8 Standards mode and higher.

Source: Read this

Starx
  • 77,474
  • 47
  • 185
  • 261
  • Yep, thanks. Already read that link, as it was included in the comments to the first post I referenced in the question. This is why I was asking if there was a fallback that worked in IE8. – Derek Henderson Jun 14 '13 at 12:41
  • @DerekHenderson, OK, if you dont like it. – Starx Jun 14 '13 at 15:38
  • 6
    This is a very misleading response. This is about the old expression method, and has nothing to do with calc. – Charlie Feb 19 '14 at 22:24