2012-02-28 42 views
-1

我不久前發現了Sinatra,並開始將我在html/php/css中創建的webform翻譯成sinatra語言。Sinitra haml:span標籤看起來不太好

在這一點上,除了一件事:一個跨度標籤,一切似乎都很好。

當我跑我的末日,我得到以下錯誤:

/aaa/bbb/.../views/index.haml在零 %span.small您的名字,

我有不知道爲什麼它不能正常工作,因爲代碼中的所有內容都工作得很好!

這裏是我的CSS文件的一部分(注意,我刪除了一些代碼,所以不會有一噸的它的%H1,%P,等,運作良好。!):

body{ 
font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; 
font-size:12px; 
/*text-align:center;*/ 
} 

p, h1, form, button{border:0; margin:0; padding:0;} 
.spacer{clear:both; height:1px;} 

.myform{ 
margin:0 auto; 
width:400px; 
padding:14px; 
} 

#stylized{ 
border:solid 2px #b7ddf2; 
background:#ebf4fb; 
} 

#stylized .small{ 
color:#666666; 
display:block; 
font-size:11px; 
font-weight:normal; 
text-align:right; 
width:145px; 
} 

這裏是HAML代碼

%html 
    %head 
    %title Website Test 
    %link(rel="stylesheet" href="css/styles.css") 
    %body 
    #stylized.myform 
     %form{ :id => "form", :name => "form", :method => "post", :action => "form1.rb"} 
     %h1 Virtual Machine Form 
     %p Please fill every field and then hit the submit button 

     %label Name 
      %span.small Add your name 
     %input{ :type => "text", :name => "name", :id => "name"} 

這裏是工作

<div id="stylized" class="myform"> 
    <form id="form" name="form" method="post" action="vmform_process.php"> 
    <h1>Virtual Machine Form</h1> 
    <p>Please fill every fields and the hit the submit button</p> 

    <label>Name 
     <span class="small">Add your name</span> 
    </label> 
    <input type="text" name="name" id="name" /> 
    ... 
    </form> 
</div> 
+0

如果你不明白錯誤字符串,那麼解釋它可能是一個壞主意。您通常會刪除可能對嘗試解決問題的人有用的信息。 – menacingly 2012-02-28 18:28:48

回答

0

你或許應該包括ACTUA的HTML代碼l錯誤。我認爲你的問題是標籤包含內聯和嵌套內容。它應該是

%label 
    Name 
    %span.small Add your name 
+0

錯誤已包含在內。你的答案雖然工作:),非常感謝 – Cocotton 2012-02-28 18:30:01

相關問題