IE9 fieldset rounded corners

2019-01-27 12:56发布

I cannot seem to make IE9 render a fieldset with rounded corners whereas other browsers do. Has anyone encountered this too ?

9条回答
够拽才男人
2楼-- · 2019-01-27 13:22

I too used to use fieldset and for more than just forms, but the constant hit and miss on compatibility has caused me to dump them. Better to write your own CSS DIV Classes that emulate fieldset. Using CSS you can get an exact replica of what fieldset looks like and you have a lot more flexibility and compatibility

查看更多
3楼-- · 2019-01-27 13:25

It is still problem under IE11 when using legend , and the solution is in this thread:

Rounded corners on a fieldset

 fieldset {
        margin:20px;
        padding:0 10px 10px;
        border:1px solid #666;
        border-radius:8px;
        box-shadow:0 0 10px #666;
        padding-top:10px;
 }  

legend {
        padding:2px 4px;
        background:#fff; 
    }


    fieldset > legend {
        float:left;
        margin-top:-20px;
    }
    fieldset > legend + * {
        clear:both;
    }

http://www.456bereastreet.com/archive/201302/fieldset_legend_border-radius_and_box-shadow/

查看更多
再贱就再见
4楼-- · 2019-01-27 13:33

From my experence in the latest version of IE9, I can not get a fieldset with legend to have a radius. I have not had any trouble with other borders in IE9, the css3 border-radius works just fine, just fieldset/ledgend. I'm still scratching my head over this.

查看更多
聊天终结者
5楼-- · 2019-01-27 13:36

I had an access only to CSS file, so I could not make any changes in HTML, so I made the hack in CSS for IE.

HTML structure was:

<form>
  <fieldset>
      ...form content...
  </fieldset>
</form>

The whole CSS for all browers and with IE hack:

fieldset {
    border-radius: 20px;
    border: 1px #3D3D3D solid;
}
@media screen and (min-width:0\0) {
    form {
        border: 1px #3D3D3D solid;
        border-radius: 20px;
    }
    fieldset {
        border: 0 none;
        margin-top: 1px;
        margin-bottom: 1px;
    }
}

Of course, if your site has another html-structure, this will not work. Therefore instead "form" you can apply in css to a parent div of your fieldset.

查看更多
太酷不给撩
6楼-- · 2019-01-27 13:37

This happens only if you use <fieldset> with <legend> - without it the corners render ok.

You can fix this bug by applying display:inline or display:inline-block to your <legend> element - but than you have to reposition it back in place by setting position:relative and moving it around.

Depending how the styling of your legend looks like (with background it will look the same - without the background the border of fieldset will still be visible behind the letters) you can make it look pretty much the same as in other normal browsers.

查看更多
疯言疯语
7楼-- · 2019-01-27 13:43

<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

This is how to fix it.

查看更多
登录 后发表回答