Chrome和Firefox CSS边框问题

时间:2013-03-26 09:03:16

标签: css google-chrome firefox border

嗨我有这个问题,我的边框显示在Firefox和Chrome中。它在Safari中看起来很精致。

这里的小提琴/现场演示:http://jsfiddle.net/hirokotenshi/JhfS8/

Chrome和Firefox中的那个看起来有些锯齿状 这里: http://i923.photobucket.com/albums/ad77/Chapter-s/Screenshot2013-03-26at43905PM_zps5d62d1c9.png

我的CSS:

#whatsnew {
  margin-top: 50px;
  border: 1px solid #D9D9D9;
  border-right: 50px solid #d52b1e;
  padding: 35px;
  -webkit-font-smoothing: antialiased;
      font-smoothing: antialiased;
  font-family: Verdana;
  padding-top: 20px;
  padding-bottom: 15px;
}

任何人都知道如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

实际上是设计 - 边框在角落处对角连接,所以你看到的是右边框的边缘逐渐变细,以满足其他1px边缘。

我能想到的最佳解决方案是使用包装器div,将1px边框应用于此,然后在内部div中保留红色边框:

HTML:

<div id="wrapper">
<div id="whatsnew">
  <div id="whatsnewtitle">What's new?</div>
  <div id="whatsnewcon">
  <b>Do you know?</b><br />
  <br />
  Royal Dutch Shell plc filed its Annual Report on Form 20-F for the year ended December 31, 2012 with the U.S. Securities and Exchange Commission.
  <br />
  <br />
  <div style="text-align: right;">
  <a href=""><b>Find out more...</b></a>
  </div>

  </div>
</div>
</div>

CSS:

#wrapper {
border: 1px solid #D9D9D9;
margin-top: 50px;
-webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
font-family: Verdana;
}
#whatsnew {
border-right: 50px solid #d52b1e;
padding: 35px;
padding-top: 20px;
padding-bottom: 15px;
}

http://jsfiddle.net/JhfS8/1/

(快速而肮脏的黑客......)

如果您想避免包装器右侧的灰色边框,您也可以将其更改为红色:

    border-right-color: #d52b1e;

...如果你想要真的聪明,你可以使用position: relative和负边距来“拉”内部div回到边界上,所以灰色消失红色背后:

http://jsfiddle.net/JhfS8/2/

答案 1 :(得分:-1)

尝试:-webkit-backface-visibility: hidden;-webkit-transform-style: preserve-3d;或在backface-visibility之后添加一些填充

相关问题