Simulation : http://jsfiddle.net/frontenddeveloper/5u38aLbg/11/
Code HTML :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
<table class="table-comparison clearfix"> <thead class="clearfix"> <tr> <th>Détail de nos offres</th> <th> <span class="offer-label">Pack premium</span><br /> <span class="offer-price">299€ soit -50%</span><br /> <button class="offer-button">Je m'abonne</button> </th> <th> <span class="offer-label">Pack numérique</span><br /> <span class="offer-price">299€ soit -50%</span><br /> <button class="offer-button">Je m'abonne</button> </th> <th> <span class="offer-label">Offre XXX</span><br /> <span class="offer-price">299€ soit -50%</span><br /> <button class="offer-button">Je m'abonne</button> </th> <th> <span class="offer-label">Offre XXX</span><br /> <span class="offer-price">299€ soit -50%</span><br /> <button class="offer-button">Je m'abonne</button> </th> <th> <span class="offer-label">Inscription</span><br /> <span class="offer-price">Gratuit</span><br /> <button class="offer-button">Je m'inscris</button> </th> </tr> </thead> <tbody> <tr> <th>Consultation des articles <a href="#">[i]</a></th> <td>illimité</td> <td>illimité</td> <td>illimité</td> <td>illimité</td> <td>8</td> </tr><tr> <th>Réception du journal en PDF dès 22h30 <a href="#">[i]</a></th> <td>oui</td> <td>oui</td> <td>non</td> <td>non</td> <td>non</td> </tr><tr> <th>Newsletters <a href="#">[i]</a></th> <td>oui</td> <td>oui</td> <td>oui</td> <td>oui</td> <td>oui</td> </tr><tr> <th>Alertes personnalisées <a href="#">[i]</a></th> <td>oui</td> <td>oui</td> <td>oui</td> <td>oui</td> <td>oui</td> </tr><tr> <th>Accès aux applications mobile et tablette <a href="#">[i]</a></th> <td>oui</td> <td>oui</td> <td>oui</td> <td>oui</td> <td>oui</td> </tr><tr> <th>La livraison du journal avant 7h30* <a href="#">[i]</a></th> <td>oui</td> <td>non</td> <td>non</td> <td>non</td> <td>non</td> </tr><tr> <th>La livraison des magazines<br />Enjeux et Série Limitée <a href="#">[i]</a></th> <td>oui</td> <td>non</td> <td>non</td> <td>non</td> <td>non</td> </tr><tr class="hide-on-mobile"> <th>Prix</th> <td> <span class="offer-price">299€</span><br /> <span class="offer-discount">soit -50%</span> </td> <td> <span class="offer-price">180€</span><br /> <span class="offer-discount">soit -50%</span> </td> <td> <span class="offer-price">299€</span><br /> <span class="offer-discount">soit -50%</span> </td> <td> <span class="offer-price">180€</span><br /> <span class="offer-discount">soit -50%</span> </td> <td>Gratuit</td> </tr><tr class="hide-on-mobile"> <th> </th> <td><button class="offer-button">Je m'abonne</button></td> <td><button class="offer-button">Je m'abonne</button></td> <td><button class="offer-button">Je m'abonne</button></td> <td><button class="offer-button">Je m'abonne</button></td> <td><button class="offer-button">Je m'inscris</button></td> </tr> </tbody> </table> |
Mixin SASS:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
.clearfix:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; } * html .clearfix { zoom: 1; } *:first-child+html .clearfix { zoom: 1; } @mixin table-comparison( $border-width: 1px, $border-color: #ddd, $cell-padding: 6px, $cell-vertical-align: middle, $cell-text-align: center, $horizontal-header-text-align: center, $vertical-header-text-align: left, $mobile-breakpoint: 979px, $mobile-horizontal-header-cell-height: 84px, $mobile-column-width: 110px, $mobile-cell-height: 68px) { /* base */ width: 100%; border-collapse: collapse; border-spacing: 0; th,td { margin: 0; } /* minimal skin */ border: $border-width solid $border-color; border-bottom: none; th,td { padding: $cell-padding; vertical-align: $cell-vertical-align; border: $border-width solid $border-color; border-bottom: none; } thead { th { text-align: $horizontal-header-text-align; &:first-child { text-align: $vertical-header-text-align; vertical-align: bottom; } } } tbody { th { text-align: $vertical-header-text-align; } td { text-align: $cell-text-align; } tr:last-child { th,td { border-top: none; border-bottom: $border-width solid $border-color; } } } @media only screen and (max-width: $mobile-breakpoint) { .hide-on-mobile { display: none !important; } /* base */ display: block; position: relative; thead { display: block; float: left; tr { display: block; } } tbody { display: block; width: auto; position: relative; overflow-x: auto; overflow-y: hidden; white-space: nowrap; tr { display: inline-block; vertical-align: top; th { white-space: normal; } } } th,td { display: block; } th { border-bottom: 0; } td { border-left: 0; border-bottom: 0; height: $mobile-cell-height; line-height: $mobile-cell-height; } /* minimal skin */ border: none; tr { th,td { border-left: none; } } thead th { border-left: $border-width solid $border-color; width: $mobile-column-width; height: $mobile-cell-height; &:first-child { height: $mobile-horizontal-header-cell-height; } } th, td { &:last-child { border-bottom: $border-width solid $border-color; } } tr { &:last-child th, &:last-child td { border-top: $border-width solid $border-color; } } tbody th { width: $mobile-column-width; height: $mobile-horizontal-header-cell-height; text-align: $horizontal-header-text-align; } } } .table-comparison { @include table-comparison(); } |