2012-12-23 98 views
10

我想在HAML實現這一點:enter image description here合併表頭

如何調整下面有合併單元格標題來完成相同的Excel圖片:

%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 

回答

12

外貌就像你想要的colspanrowspan屬性一樣。 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 
+1

做得非常好,很高興能夠觀看你的編輯,幫助我學習你的思路。今晚轉換爲Haml,你讓我微笑,因爲它實現了! –

+0

@chrisFrisina:哈,感謝Haml的速成班! :) – Ryan