2012-02-28 43 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

相关问题