2010-11-14 17 views
1

所有支持的浏览器我有这样的片段:鉴于here编辑here中心文字与CSS

我怎样才能让在圆圈中的“X”留在所有支持的浏览器(至少Firefox3的+和铬)

段:

<!DOCTYPE HTML> 
<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    <title>Backbone: Tody</title> 

    <style> 
    .delete { 
     -moz-border-radius: .75em; 
     -webkit-border-radius: .75em; 
     width: 1.4em; 
     height: 1.4em; 
     text-align: center; 
     display: inline-block; 
     line-height: 1.4em; 
     display:inline-block 
     vertical-align:middle 
     font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 
     font-size: 14px; 
     font-weight: bold; 
     color: white; 
     background-color: gray; 
     cursor: pointer; 
    } 
    .delete:before { 
     content: "\2715"; 
     /* content: "\00D7"; */ 
    } 
    .delete:hover { 
     background-color: red; 
    } 
    </style> 

</head> 
<body> 

<div class="delete"></div> 

</body> 
</html> 
+0

它不是已经在中间了吗? – 2010-11-14 19:40:47

+0

该版本在FF上可以正常使用,但不能在Chrome上使用,必须有一些可以在 – clyfe 2010-11-14 19:50:41

回答

0

我通过设置这样的余量,使内部空间(盒+填充)将得到这个工作与字体大小相同。 http://jsbin.com/unera3/5/edit

<!DOCTYPE HTML> 
<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    <title>Backbone: Tody</title> 

    <style> 
    .delete { 
     -moz-border-radius: .75em; 
     -webkit-border-radius: .75em; 
     width: 1.4em; 
     height: 1.4em; 
     text-align: center; 
     line-height: 1.4em; 
     vertical-align:middle 
     font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 
     font-size: 14px; 
     font-weight: bold; 
     color: white; 
     background-color: gray; 
     cursor: pointer; 
    } 
    .delete:before { 
     content: "\2715"; 
     /* content: "\00D7"; */ 
    } 
    .delete:hover { 
     background-color: red; 
    } 
    </style> 

</head> 
<body> 

<div class="delete"></div> 

</body> 
</html> 
0

如果你希望它是像素完美的跨浏览器,最好的办法可能是使用图像 - 定位x将取决于不同的浏览器默认字体大小。

这么说,我会说这是在OS X中FF4b和Chrome 7足够近...

+0

上使用的东西,这主要是一个实验 – clyfe 2010-11-14 19:50:59