2017-03-09 82 views
-1

我有這兩行代碼在Chrome和Firefox中工作,但不在IE11中。帶有小數點的計算器在IE11中不起作用?

height: calc((100% - 25px)/2); // this is not working 
left: calc(105px/2); // this is working 

請給我建議一個解決方案。

.relative-cell{ 
 
    position: relative; 
 
    height: 100%; 
 
} 
 
.downline, .upline{ 
 
    position: absolute; 
 
    height:calc((100% - 25px)/2); 
 
    background-color:rgba(0, 0, 0, 0.2); 
 
    width: 1px; 
 
    left:calc(105px/2); 
 
}
<td class="relative-cell"> 
 
    <div class="transaction-body transaction-date-section flex-row to-center to-mid"> 
 
     <div one-svg="long-arrow" class="account-transaction-type transaction-type"></div> 
 
    </div> 
 
    <div class="downline"></div> 
 
    <div class="upline"></div> 
 
</td>

+0

IE的哪個版本calc()? 7? 8? 9? 10? 11?企業模式?兼容性視圖啓用?任何組策略設置或站點列表?我們需要的不僅僅是「它在IE中不起作用」。 – csmckelvey

+0

請按建議添加信息,並提供測試示例(例如內聯代碼片段或JSFiddle)。 –

+0

閱讀這個問題,看看不是calc是這裏打破的那個,如果不是所有的父母都有100%定義的身高,那麼100%的身高不起作用。 http://stackoverflow.com/questions/16811716/height100-not-working-in-internet-explorer –

回答

-1

這是IE11一個已知問題,它不支持嵌套計算。

IE11被報告在使用嵌套表達式calc(), (例如,寬度:calc((100%-10px)/ 3); (即便將不同)

上CanIUse.com

+1

這段代碼沒有轉換。 – TylerH

+0

我更新了答案以引用IE和'calc()'的正確問題。 –