Div Style - IE的问题

时间:2012-12-24 09:06:29

标签: css internet-explorer html border

我有这个简单的DIV,可以在Firefox,Chrome等中显示,但不是IE。我有以下html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <style>
      div.example {
        position:absolute; 
        color:black; 
        text-align:left;
        border:2px solid#000;  
        border-radius:15px; 
        -moz-border-radius:15px; 
      }
    </style>
  </head>
  <body>
    <div class="example" style="height:15em;width:10em;"></div>
  </body>
</html>

在Firefox中,我获得了一个圆形的2px黑色边框。在IE中什么也得不到。根据我的阅读,直到IE9才支持圆形边框,但我想要2px黑色边框,即使它不是圆形的。无论如何,在Firefox,Chrome,IE和&amp ;;苹果浏览器 ?在此先感谢:)

1 个答案:

答案 0 :(得分:1)

您在边框样式中缺少空格 这是working demo

<强> HTML

<div class="example">&nbsp;</div>

<强> CSS

div.example {
    position: absolute;
    color: black;
    text-align: left;
    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    border-radius: 15px;
    border: 2px solid #000;
    width: 10em;
    height: 15em;
}

另外,作为旁注,

应始终在border-radius之后调用{p> -prefix-border-radius
订单的例子:

...
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
...