Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merged Table Headers in Haml

Tags:

html

haml

I am trying to accomplish this in haml:enter image description here

How do I adjust the following to have merged cell headers to accomplish the same as the excel picture:

%table
  %tbody
    %tr
      %th Name
      %th Sunday      
      %th Monday
      %th Tuesday
      %th Wednesday
      %th Thursday
      %th Friday
      %th Saturday
    %tr
      %th 1
      %th 2
      %th 3
      %th 4
      %th 5
like image 785
chris Frisina Avatar asked Dec 23 '12 02:12

chris Frisina


1 Answers

Looks like you want the colspan and rowspan attributes. Here's a demo.

%table
  %tbody
    %tr
      %th{:rowspan => 2} Name 
      %th{:colspan => 5} Sunday
      %th{:colspan => 5} Monday
      %th{:colspan => 5} Tuesday
      %th{:colspan => 5} Wednesday
      %th{:colspan => 5} Thursday
      %th{:colspan => 5} Friday
      %th{:colspan => 5} Saturday
    %tr
      - 7.times do
        %th 1
        %th 2
        %th 3
        %th 4
        %th 5
like image 159
Ry- Avatar answered Nov 17 '22 07:11

Ry-