在网頁制作时,圆角的样式在很多时候都要到,大多数都是用图片来搞,其实图片不图片无所谓的,但也有的朋友比较喜欢用CSS来写,CSS写的话在火狐、谷歌等浏览器都是没有问题的。但是在IE下就会出现问题,圆角就没有了。这时候就要用到一个文件,当时那个文件是哪里下的已经记不清了,但用着还是挺不错的。由于不知道怎么上传文件,就只能把源码弄出来了。
test.html
<html>
<head><title>test</title>
<style type=”text/css”>
.test {
width:100px;
height:100px;
background-color: blue;
margin-bottom:10px;
border-radius: 10px;
behavior: url(ie-css3.htc);
}
</style>
</head>
<body>
<div class=”test”>
test
</div>
</body>
</html>
ie-css3.htc
–Do not remove this if you are using–
Original Author: Remiz Rahnas
Original Author URL: http://www.htmlremix.com
Published date: 2008/09/24
Changes by Nick Fetchak:
– IE8 standards mode compatibility
– VML elements now positioned behind original box rather than inside of it – should be less prone to breakage
– Added partial support for ‘box-shadow’ style
– Checks for VML support before doing anything
– Updates VML element size and position via timer and also via window resize event
– lots of other small things
Published date : 2010/03/14
http://fetchak.com/ie-css3
Thanks to TheBrightLines.com (http://www.thebrightlines.com/2009/12/03/using-ies-filter-in-a-cross-browser-way) for enlightening me about the DropShadow filter
<public:attach event=”ondocumentready” onevent=”ondocumentready(‘v08vnSVo78t4JfjH’)” />
<script type=”text/javascript”>
timer_length = 200; // Milliseconds
border_opacity = false; // Use opacity on borders of rounded-corner elements? Note: This causes antialiasing issues
// supportsVml() borrowed from http://stackoverflow.com/questions/654112/how-do-you-detect-support-for-vml-or-svg-in-a-browser
function supportsVml() {
if (typeof supportsVml.supported == “undefined”) {
var a = document.body.appendChild(document.createElement(‘div’));
a.innerHTML = ‘<v:shape id=”vml_flag1″ adj=”1″ />’;
var b = a.firstChild;
b.style.behavior = “url(#default#VML)”;
supportsVml.supported = b ? typeof b.adj == “object”: true;
a.parentNode.removeChild(a);
}
return supportsVml.supported
}
// findPos() borrowed from http://www.quirksmode.org/js/findpos.html
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
新闻热点
疑难解答