2011-04-11 120 views
1

我写了一个CSS为foolows:圆角通过CSS

<style> 
#box_1 #box1_bg{ 
    width: 100px; 
    padding-left:0px; 
    font-family: "cachet Bold" , "CachetBoldRegular"; 
    font-weight: bold; 
    color: #FFFFFF; 
    text-decoration: none; 
    font-size: 21px; 
    text-align:center; 
    padding-top:10px; 
    height:30px; 
    border-bottom-style:groove; 
     -moz-border-radius-bottomleft: 10px; 
     -moz-border-radius-bottomright: 10px; 
     -webkit-border-bottom-left-radius: 10px; 
     -webkit-border-bottom-right-radius: 10px; 



} 
</style> 

这是给我的状结构一个箱.. 我怎样才能获得圆角这个盒子?

+0

我不明白你的问题,你想这个元素的角落舍入? – Kyle 2011-04-11 12:30:46

+0

我假设你在Firefox或Webkit浏览器上测试?你有没有尝试border-bottom-right-radius:10px;? – Tarscher 2011-04-11 12:30:49

+0

看看http://www.css3pie.com/ - 这对IE来说是一个黑客,它支持'border-radius'(以及更多)。 – Spudley 2011-04-11 12:49:39

回答

1

如果您不使用支持CSS3的浏览器,则不会看到弯角。这包括所有版本的IE直到并包括8.同时确保你有一个border-color定义,所以你可以实际看到边框,或者background-color

+0

'边框颜色'不需要定义,'背景'确实 – 2011-04-11 12:33:19

2

您需要添加背景或边框才能看到圆角。

#box_1 #box1_bg{ 
    width: 100px; 
    padding-left:0px; 
    font-family: "cachet Bold" , "CachetBoldRegular"; 
    font-weight: bold; 
    color: #FFFFFF; 
    text-decoration: none; 
    font-size: 21px; 
    text-align:center; 
    padding-top:10px; 
    height:30px; 
    border:5px groove yellow; 
    -moz-border-radius-bottomleft: 10px; 
    -moz-border-radius-bottomright: 10px; 
    -webkit-border-bottom-left-radius: 10px; 
    -webkit-border-bottom-right-radius: 10px; 
} 
0

我使用border-radius:10px;,它适用于FF4,Chrome,Safari和Opera。

或者你可以为不同的半径做border-radius:10px 3px 7px 2px每个角落

,不要忘记background:#000;或东西给你的箱子一些外观

+0

@所有....我不能这样做,不给边框.. – Ketaki 2011-04-11 12:44:43

+0

你可以做'border:0px',仍然有'边界半径“,是 – 2011-04-11 13:10:49

0

在哪个浏览器中预览该图?

注意,标准CSS3边框半径属性被称为border-radius

你申请你的规则只Mozilla和WebKit浏览器。

像这样的跨浏览器选择应该这样做:

.round { 
-moz-border-radius-bottomleft:10px; 
-moz-border-radius-bottomleft:10px; 
-webkit-border-bottom-left-radius:10px; 
-khtml-border-bottom-right-radius: 10px; 
-khtml-border-bottom-left-radius: 10px; 
-webkit-border-bottom-right-radius:10px; 
-webkit-border-bottom-left-radius:10px; 
border-radius:0 0 10px 10px; 
/* optional behavior: url(border-radius.htc) */ 
} 

注:只有当你需要强制为IE6-8支持宏达文件被使用。

+0

我发现IE .htc破解最好,在一些安装,任何版本,IE只是炸毁。 – 2011-04-11 12:54:43

+0

是的,实际上一种更稳固的解决方案是使用PIEcss3或条件注释和背景图像(这是我测试出来的最坚实的方法)。相对位置通常会解决.htc问题。 – easwee 2011-04-11 12:56:22