Error with Cap in Safari!

Asked

Viewed 58 times

3

I’m having trouble with Safari 5.1, css width: Calc(100% - 350px); it doesn’t work properly in safari, follow the code and jsfiddle:

JSFIDDLE

<div id="menu"></div>
<div id="conteudo2"></div>

#conteudo2 {
width: -webkit-calc(100% - 150px);
width: -moz-calc(100% - 150px);
width: calc(100% - 150px);
background-color: #333333;
float: left;
height: 920px;
margin-top: -10px;
}

#menu {
width: 150px;
float: left;
height: 900px;
background-color: #f2f2f2;
}

Other browsers are working properly!!

1 answer

4


The Calc function is only supported from safari 6.0.

Source: https://developer.mozilla.org/en-US/docs/Web/CSS/calc#Browser_compatibility

You can do the calculations using javascript, for example:

var element1 = document.getElementById('elemento1');
var element2 = document.getElementById('elemento2');
element2.style.width = element1.style.width - 350;

Something like that.

  • And what is the best solution to this problem ?

  • @Alanps Do these calculations with javascript. I’ll edit the answer and show you how to do it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.