Rails haml,table,如何设置td最小宽度?

发布于 2024-12-12 00:38:37 字数 259 浏览 0 评论 0原文

我正在尝试使用表格来布局表单。我使用rails和haml。 我有下面的代码,但我无法让 min_width 工作 - 文本“min_width”等实际上显示在页面中。

  %table
    %tr 
      %td min_width => "100px;"
      ='aaa'   
      %td.field  
        = f.input :last_name, :label => ' '

I am trying to layout out a form using a table. I use rails and haml.
I have the code below but I can't get the min_width to work - the text "min_width", etc. actually show up in the page.

  %table
    %tr 
      %td min_width => "100px;"
      ='aaa'   
      %td.field  
        = f.input :last_name, :label => ' '

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

公布 2024-12-19 00:38:37

将行更改

%td min_width => "100px;"

%td{:min_width => "100px;"}

Change the line

%td min_width => "100px;"

to

%td{:min_width => "100px;"}
绝影如岚 2024-12-19 00:38:37

我意识到这有点老了。 @matt 的回答让我走上了正轨,但我最终不得不使用:

%td{:style => "min-width:100px;"}= ColumnName

I realize this is kind of old. @matt's answer put me on the right track, but I ended up having to use:

%td{:style => "min-width:100px;"}= ColumnName
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文