【发布时间】:2012-02-29 02:26:50
【问题描述】:
不久前我发现了 Sinatra,并开始将我用 html/php/css 制作的 webform 翻译成 sinatra 语言。
在这一点上,一切似乎都很好,除了一件事:一个跨度标签。
当我运行我的 sinatra 时,我收到以下错误:
/aaa/bbb/.../views/index.haml in nil %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"}
这是正在运行的 html 代码
<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>
【问题讨论】:
-
如果您不理解错误字符串,那么解释它可能是个坏主意。您通常会删除可能对试图找出您的问题的人有所帮助的信息。