0

我只想这样做。

<p><form blabla></form><form blabla></form></p>

所以,在rails 2.8.3上我是这样写的。

<p>
<%- form_tag blabla -%><%- end -%>
<%- form_tag blabla -%><%- end -%>
</p>

但结果是这样的。

<p></p>
<form blabla></form>
<form blabla></form>
<p></p>

如何避免自动插入段落标签?

4

1 回答 1

0

It's not valid html to nest form tags inside a p tag so your browser is trying to fix it for you. http://www.w3.org/TR/html401/struct/text.html#h-9.3.1

You can verify that the browser is altering this this by:

telnet localhost 3000
GET /wherever/this/is HTTP/1.0

And you will see something like:

<p>
<form action="/dog" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="HxzAQS/UMwdXmcMzX+qk9eV49JCmwnds9bekrr3YKj0=" /></div></form><form action="/dog" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="HxzAQS/UMwdXmcMzX+qk9eV49JCmwnds9bekrr3YKj0=" /></div></form></p>
于 2013-04-27T05:15:10.677 回答