用两种方式已实现,使用ie-css3.htc与pie.htc已实现!
获取htc位置,已上传到码云!
https://gitee.com/kong_qing_rong/daily-component-library?_from=gitee_search
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.border-radius-temp{
width: 40px;
height: 40px;
margin: 10px;
background-color: red;
text-align: center;
display: table-cell;
vertical-align: middle;
border-radius: 20px;
color: white;
font-weight: bolder;
border: 1px solid red;
/*关键属性设置 需要把路径设置好*/
behavior: url(./css/PIE.htc);
}
.radius{
width:40px;
height: 40px;
margin: 10px;
background-color: red;
text-align: center;
display: table-cell;
vertical-align: middle;
color: white;
font-weight: bolder;
border-radius: 20px;
border:1px solid red;
behavior:url(./css/ie-css3.htc);
}
</style>
</head>
<body>
<div id="pieHtc" class="border-radius-temp"></div>
<div id="ieCss3Htc" class="radius"></div>
<script type="text/javascript">
var pieHtc = document.getElementById("pieHtc");
pieHtc.innerText = "123";
var ieCss3Htc = document.getElementById("ieCss3Htc");
ieCss3Htc.innerText = "456";
</script>
</body>
</html>
htc存放位置图:
至于为什么ie8与ie6,7,显示不同,是因为ie6,7不支持display: table-cell;该属性值!