2012-02-08 52 views
0

我想知道如何创建特定于safari(5)或更少的CSS文件。如何编写Safari(5)特定的CSS?

+0

你需要给更多的细节。你是说浏览器特定的前缀到CSS属性,或者如何通常创建一个CSS文件? – 2012-02-08 19:40:56

+0

你为什么想这样做? – thirtydot 2012-02-08 19:41:16

+0

我有一个CSS问题。它适用于所有浏览器,除safari.so我想知道是否有任何方法来编写特定的css文件来定位Safari,就像我们为IE做的那样。 – Ninu 2012-02-08 19:44:17

回答

3

如果你想有一个执行的Safari和Chrome的一些CSS代码,你必须检查为-webkit-前缀

例如CSS的This is an example当浏览器Safari或任何浏览器能够理解的,将只适用-webkit-前缀

@media screen and (-webkit-min-device-pixel-ratio:0) 
{ 
    #safari { display: block; } 
} 

只是一个提醒,这不是故障安全的解决方案。

+1

这显然也将在Chrome中应用。也许OP想要这样做,但目前还不清楚,但这样做并不是一个好主意。 – thirtydot 2012-02-08 19:45:56

+0

我正在使用网络字体并使用@ font-face将其导入到css中 除safari以外,所有浏览器都会正确渲染它,当在safari中font-weight设置为粗体时,字体超级粗体。我想设置字体权重到正常只为safari看看它是否正确渲染。 – Ninu 2012-02-08 20:23:59

+0

我也想知道safari会使用哪种格式? – Ninu 2012-02-08 20:25:13

0

为四个空格创建代码块或其他预格式化文本,缩进:

This will be displayed in a monospaced font. The first four spaces 
will be stripped off, but all other whitespace will be preserved. 

Markdown and HTML are turned off in code blocks: 
<i>This is not italic</i>, and [this is not a link](http://example.com) 

要创建不是一个块,而是内嵌码跨度,使用反引号:

$角色仅仅是一个window.jQuery的快捷方式。

如果你想通过八个空格有一个列表中的预格式化块,缩进:

  1. 这是正常的文本。
  2. 原来是这样,但现在如下代码块:

    Skip a line and indent eight spaces. 
    That's four spaces for the list 
    and four to trigger the code block.