2011-11-12 33 views

回答

4

它确实有效。

使用生成标准404.html文件:

<!DOCTYPE html> 
<html> 
<head> 
    <title>The page you were looking for doesn't exist (404)</title> 
    <style type="text/css"> 
    body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } 
    div.dialog { 
     width: 25em; 
     padding: 0 4em; 
     margin: 4em auto 0 auto; 
     border: 1px solid #ccc; 
     border-right-color: #999; 
     border-bottom-color: #999; 
    } 
    h1 { font-size: 100%; color: #f00; line-height: 1.5em; } 
    </style> 
</head> 

<body> 
    <!-- This file lives in public/404.html --> 
    <div class="dialog"> 
    <h1>The page you were looking for doesn't exist.</h1> 
    <p>You may have mistyped the address or the page may have moved.</p> 
    </div> 
</body> 
</html> 

我使用的代码/格式化选项,它导致了以下内容:

<!DOCTYPE html> 
<html> 
<head> 
    <title>The page you were looking for doesn't exist (404)</title> 
    <style type="text/css"> 
     body { 
      background-color: #fff; 
      color: #666; 
      text-align: center; 
      font-family: arial, sans-serif; 
     } 

     div.dialog { 
      width: 25em; 
      padding: 0 4em; 
      margin: 4em auto 0 auto; 
      border: 1px solid #ccc; 
      border-right-color: #999; 
      border-bottom-color: #999; 
     } 

     h1 { 
      font-size: 100%; 
      color: #f00; 
      line-height: 1.5em; 
     } 
    </style> 
</head> 

<body> 
<!-- This file lives in public/404.html --> 
<div class="dialog"> 
    <h1>The page you were looking for doesn't exist.</h1> 

    <p>You may have mistyped the address or the page may have moved.</p> 
</div> 
</body> 
</html> 

你可以看到它是如何重新格式化特别是样式(如果我改变换行符等,它也修复了这些问题)。

如果您转到文件/设置,IDE设置/编辑器,然后确保选中显示“重新格式化代码”对话框已选中[x],请重试。它可能被设置为仅修复选定的文本?或...

+0

我看到你是对的。我期待VS更像VS, RubyMine在清理空白时并不像VS那么具有攻击性。 – jcollum

+0

同意。我喜欢VS一般更好一点,尤其是有更多的控制。 – WiredPrairie

2

您可以使用⌘+⌥+ l键盘快捷键。

0

您可以更改“项目设置>代码样式> HTML”中的html格式选项。

例如:你可以改变标签的大小,缩进等

如果你是在OSX上,你可以使用快捷键⌘+,

其他建议:尝试重命名格式之前的文件(除从它的.erb)