1

我有这个片段:查看这里编辑这里

如何让“x”在所有支持的浏览器(至少 firefox3+ 和 chrome)上保持在圆圈的中间

片段:

<!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>
4

2 回答 2

0

如果您希望它在浏览器中保持像素完美,最好的选择可能是使用图像——x 的位置将取决于不同浏览器中的默认字体大小。

也就是说,我想说它在 FF4b 和 OS X 上的 Chrome 7 中已经足够接近了......

于 2010-11-14T19:43:57.627 回答
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>
于 2010-11-14T20:12:20.543 回答