0

In safari browser my background-image is not working. When I inspected in safari I found there the css3 calc() function is not working. I have used like this

width: calc(100% - 345px);
height: calc(100% - 180px);

Does safari do not support calc() function? If not, how can make a function with jQuery that my calc() function would work.

Edit

I've defined calc() function many times in my stylesheet. So I would like to use jQuery but how do I select the element which value is defined calc()?

Suppose the following div I have applied with css

div.one{width: 300px;}
div.two{width: 300px;}
div.three{width: 200px;}

How can select those divs which width is defined 300px?

Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231

2 Answers2

0

Use this

$('selector').css('width', '100%').css('width', '-=345px');
$('selector').css('width', '100%').css('width', '-=180px');
Navin Rauniyar
  • 10,127
  • 14
  • 45
  • 68
0

In this case, it sounds like you're using a browser version that doesn't support the feature you're using.

When deciding whether or not to use a given feature, you should check for browser compatibility at the CanIUse site. This will also tell you whether you need to use vendor prefixes, and about any known issues with the feature.

Please note that even when a specific browser feature does work in your browser, you need to consider your end users as well -- use the CanIUse site to check for support across all browsers and versions that you need to support. You should also test your site in a variety of browsers and browser versions.

In the case of calc(), you could consider using this polyfill to back-port the calc() feature into older browsers that don't support it.

Spudley
  • 166,037
  • 39
  • 233
  • 307