gpt4 book ai didi

ruby-on-rails - HAML:表格列的宽度不起作用

转载 作者:数据小太阳 更新时间:2023-10-29 07:57:23 26 4
gpt4 key购买 nike

这一切都不起作用。当我在大文本表中向右深处输入时,会出现水平导航。

index.haml

%table{:border => 1, :width => "100%"}
%tr
%th{:width => "200"} Name
%th.edit Edit

- @wallpapers.each do |wallpaper|
%tr
%td.name= wallpaper.name
%td= link_to (image_tag wallpaper.thumb.url(:thumb)), edit_wallpaper_path(wallpaper)
%td= button_to 'Delete', wallpaper_path(wallpaper), :confirm => 'Are you sure you want to delete this wallpaper?', :method => :delete

样式.css

th.edit {width:20%;}
td.name {width:20%;}

最佳答案

你真的想设置样式,而不是html属性

试试这个:

%table{:style=>"border: 1px; width: 100%"}

您实际创建的是:

<table border="1" width="100%">

你应该创建:

<table style="border: 1px; width: 100%">

当然,使用类和CSS会更好,但这可以解决燃眉之急。

关于ruby-on-rails - HAML:表格列的宽度不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7808888/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com