HAML: table column's width not working
10,751
You really want to set the style, not html attributes
Try this:
%table{:style=>"border: 1px; width: 100%"}
What you're actually creating is:
<table border="1" width="100%">
And you should be creating:
<table style="border: 1px; width: 100%">
of course, using classes and CSS would be better, but this will solve immediate concern.
Comments
-
TiSer almost 2 years
Nothing from this not working. When I typing large text table going deep right and horizontal nav appears.
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
style.css
th.edit {width:20%;} td.name {width:20%;}