关于背景和calc()的一个小问题

时间:2018-09-18 01:44:39

标签: css3 internet-explorer-11 calc background-position

全部。

我正在做一个项目。我有一个小问题。关于calc函数。

众所周知。 在所有浏览器上都可以使用。.

===========好的============

background-color:#dfdfdf;
background-image:url(..);
background-position: calc(100% - 10px) center;
background-repeat: no-repeat;

但是为什么下一个代码在IE11上不起作用?

==========不能在IE 11上运行=============

background:#dfdfdf url(..) no-repeat calc(100% - 10px) center;

-_- ;;;;;;;;;;;;;;

1 个答案:

答案 0 :(得分:0)

ie11必须单独使用

body
     {
background:#dfdfdf url("https://www.w3schools.com/w3css/img_lights.jpg") no-repeat;
background-position:calc(100% - 100px) center;
}
<!DOCTYPE html>
<html>
<head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8">
     <link rel="stylesheet" type="text/css" href="css/style.css">
     <title>Page Title</title>
     <meta name="description" content="Write some words to describe your html page">
   
</head>
<body>


</body>

</html>