2012-12-24 82 views
-1

我有这个简单的DIV,在Firefox,Chrome等显示不错,但不是IE浏览器。我有以下的html:Div风格 - 问题与IE

<!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浏览器& Safari?在此先感谢:)

+1

有什么问题? – Blender

+0

哪里是位置:相对; 。当您使用相对位置时,可以使用绝对位置; –

+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应该总是被称为-prefix-border-radius后,订单
例如:

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