How can I use Modernizr to get border-radius working in IE8?

删除回忆录丶 提交于 2019-12-06 11:31:15

Modernizr does not enable features, it just tests if they are available. For CSS, it can also remove the need to use vendor specific properties such as -moz-* and -webkit-* allowing you to simply use the standard properties instead:

.myElement {
    -webkit-border-radius: 20px; /* No need for this */
    -moz-border-radius: 20px;    /* No need for this */
    border-radius: 20px;
}

For rounded corners in IE8, I wouldn't bother with Modernizr feature detection, simply use CSS PIE to enable them.

.myElement {
    border-radius: 8px;
    behavior: url(/PIE.htc); /* only IE will use this */
}

Make sure to read the docs on how to get this to work.

As a side note, standard border-radius has been supported for quite some time now by mozilla and webkit browsers, you might want to check to see if you are actually targeting any browsers that need those prefixes: http://caniuse.com/#search=border-radius (click "Show all versions")

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!