简体   繁体   English

IE 7/8中选项卡上的CSS圆角

[英]CSS rounded corner on tabs in IE 7/8

I am using jQuery to get the rounded corner for tabs in UI. 我正在使用jQuery来获取UI中选项卡的圆角。 My issue is it works well in firefox and Ie9 but fails in IE7 and IE8(tab looks like a square. Is it an issue to everyone or is there a fix? 我的问题是它在firefox和Ie9中运行良好但在IE7和IE8中失败(选项卡看起来像一个正方形。这是一个问题给每个人还是有修复?

<div id="fig">
        <div id="fig-tabs">
          <strong class="tab-current">1st tab</strong> <a href="" class="tab">2nd tab</a> <a href="" class="tab">3rd tab</a>
        </div>
...</div>

and css is, 和css是,

#fig-tabs { }

strong.tab-current
{
    background-color: #FFF;
    padding: 3px 8px 7px 8px;
    -moz-border-radius: 4px 4px 0px 0px;
    border-radius: 4px 4px 0px 0px;
    text-decoration: none;
}

a.tab
{
    background-color: #999;
    padding: 3px 8px 2px 8px;
    -moz-border-radius: 4px 4px 0px 0px;
    border-radius: 4px 4px 0px 0px;
    text-decoration: none;
}

a.tab:hover { background-color: #9ffff; }

To start i'd say your problem is that the code you are writing uses the <canvas> tag/element which older versions of internet explorer don't support. 首先,我要说你的问题是你正在编写的代码使用旧版本的Internet Explorer不支持的<canvas>标签/元素。 What you can use 你可以用什么

Why not just use css3 border-radius properties to set up your rounding. 为什么不使用css3 border-radius属性来设置舍入。 These still won't work in internet explorer but are nicer and easier to code. 这些仍然无法在Internet Explorer中工作,但更好,更容易编码。 Really in this day and age this sort of thing should be done using css3 . 真的在这个时代,这种事情应该使用css3来完成。 There are compatibility libraries that will work for IE's before 9. 有兼容性库可以在9之前用于IE。

If you really want your rounded corners in the old browser versions you are going to need to use a pre created image. 如果您真的想在旧浏览器版本中使用圆角,则需要使用预先创建的图像。

EDIT: As the other answer stated you can use the internet explorer canvas library,but you will need to change you getContext call to the following as your canvas tag is dynamically generated 编辑:正如另一个答案所述,您可以使用Internet Explorer画布库,但是您需要将getContext调用更改为以下内容,因为您的canvas标签是动态生成的

var el = document.createElement('canvas');
G_vmlCanvasManager.initElement(el);
var ctx = el.getContext('2d');

EDIT2: Now your problem is that the css3 properties are also not supported in IE 7/8. EDIT2:现在你的问题是IE 7/8也不支持css3属性。 Try using a library (one of the comments recommended http://css3pie.com/ to add that support into the older browsers 尝试使用库(建议http://css3pie.com/之一的评论将该支持添加到旧版浏览器中

The canvas element is not supported in IE7/IE8, you can use a library that gives it support found here . IE7 / IE8不支持canvas元素,您可以使用一个库,在此处提供支持。 Give that a try. 试一试。

what about classic way of doing it using backgrounds on lays of divs 怎么样的经典方式使用背景上的divs

<div><!--top-->
  <div><!--repeat-->
    <div><!--bottom-->

    </div>
  </div>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM