Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Responsywna tabela
kubax33
post 23.08.2014, 10:44:25
Post #1





Grupa: Zarejestrowani
Postów: 157
Pomógł: 1
Dołączył: 27.01.2010

Ostrzeżenie: (0%)
-----


Mam taką responsywną tabelę wszytko ładnie działa jednak problem pojawia się kiedy chcę ją użyć dla innych stron gdzie są inne nazwy "<th></th>". Chciałbym, aby w jednej tabeli było<th>Login</th> a w całkiem innej <th>Nazwisko</th>. Czy może tutaj trzeba użyć jakieś osobnego class do tabeli z td:nth-of-type(1):before ? Nie chciałbym tworzyć np. #tab_res2 bo to bez sensu. Jak to ugryźć?

  1.  
  2. #tab_res table {
  3. width: 100%;
  4. text-align: center;
  5. margin-top: 20px;
  6. }
  7. #tab_res thead tr {
  8. background: #fff;
  9. }
  10. #tab_res td, th {
  11. padding: 3px;
  12. }
  13.  
  14. @media only screen and (max-width: 692px),(min-device-width: 768px) and (max-device-width: 1024px) {
  15.  
  16. #tab_res .akcje {
  17. background: #ccc;
  18. color: #ccc;
  19. }
  20.  
  21. #tab_res table, thead, tbody, th, td, tr {
  22. display: block;
  23. }
  24. #tab_res thead tr {
  25. position: absolute;
  26. top: -9999px;
  27. left: -9999px;
  28. }
  29.  
  30. #tab_res tr {
  31. border: 1px solid #ccc;
  32. }
  33.  
  34. #tab_res td {
  35. border: none;
  36. border-bottom: 1px solid #e8e8e8;
  37. position: relative;
  38. padding-left: 50%;
  39. background: #fff;
  40. }
  41.  
  42. #tab_res td:before {
  43. position: absolute;
  44. top: 6px;
  45. left: 6px;
  46. width: 45%;
  47. padding-right: 10px;
  48. white-space: nowrap;
  49. }
  50.  
  51. #tab_res td:nth-of-type(1):before { content: "Login"; line-height: 8px;}
  52. #tab_res td:nth-of-type(2):before { content: "Imię"; line-height: 8px;}
  53. #tab_res td:nth-of-type(3):before { content: "Miejcowość"; line-height: 8px;}
  54. #tab_res td:nth-of-type(4):before { content: "Kod pocztowy"; line-height: 8px;}
  55.  
  56. }


  1. <div id='tab_res'>
  2. <tr>
  3. <th>Login</th>
  4. <th>Imię</th>
  5. <th>Miejcowość</th>
  6. <th>Kod pocztowy</th>
  7. </tr>
  8. </thead>
  9.  
  10. <td>xxx</td>
  11. <td>xxx</td>
  12. <td>xxx</b></td>
  13. <td>xxx</td>
  14.  
  15.  
  16. </div>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
aniolekx
post 23.08.2014, 12:10:11
Post #2





Grupa: Zarejestrowani
Postów: 340
Pomógł: 46
Dołączył: 31.07.2009
Skąd: A

Ostrzeżenie: (0%)
-----


polecam http://getbootstrap.com/, może ci się spodoba smile.gif
Go to the top of the page
+Quote Post
kubax33
post 23.08.2014, 15:40:46
Post #3





Grupa: Zarejestrowani
Postów: 157
Pomógł: 1
Dołączył: 27.01.2010

Ostrzeżenie: (0%)
-----


Rozwiązałem to kolejnym divem innego wyjścia nie widzę choć zapewne idzie to zrobić lepiej.

  1.  
  2. #tab_res table {
  3. width: 100%;
  4. text-align: center;
  5. margin-top: 20px;
  6. }
  7. #tab_res thead tr {
  8. background: #fff;
  9. }
  10. #tab_res td, th {
  11. padding: 3px;
  12. }
  13.  
  14. @media only screen and (max-width: 692px),(min-device-width: 768px) and (max-device-width: 1024px) {
  15.  
  16. #tab_res .akcje {
  17. background: #ccc;
  18. color: #ccc;
  19. }
  20.  
  21. #tab_res table, thead, tbody, th, td, tr {
  22. display: block;
  23. }
  24. #tab_res thead tr {
  25. position: absolute;
  26. top: -9999px;
  27. left: -9999px;
  28. }
  29.  
  30. #tab_res tr {
  31. border: 1px solid #ccc;
  32. }
  33.  
  34. #tab_res td {
  35. border: none;
  36. border-bottom: 1px solid #e8e8e8;
  37. position: relative;
  38. padding-left: 50%;
  39. background: #fff;
  40. }
  41.  
  42. #tab_res td:before {
  43. position: absolute;
  44. top: 6px;
  45. left: 6px;
  46. width: 45%;
  47. padding-right: 10px;
  48. white-space: nowrap;
  49. }
  50.  
  51. #tab_res td:nth-of-type(1):before { content: "Login"; line-height: 8px;}
  52. #tab_res td:nth-of-type(2):before { content: "Imię"; line-height: 8px;}
  53. #tab_res td:nth-of-type(3):before { content: "Miejcowość"; line-height: 8px;}
  54. #tab_res td:nth-of-type(4):before { content: "Kod pocztowy"; line-height: 8px;}
  55.  
  56. }
  57.  
  58.  
  59. @media only screen and (max-width: 692px),(min-device-width: 768px) and (max-device-width: 1024px)
  60. {
  61.  
  62. #tab_res_2 td:nth-of-type(1):before { content: ""; }
  63. #tab_res_2 td:nth-of-type(2):before { content: "Login2"; line-height: 8px;}
  64. #tab_res_2 td:nth-of-type(3):before { content: "Imię2"; line-height: 8px;}
  65. #tab_res_2 td:nth-of-type(4):before { content: "Nazwisko2"; line-height: 8px;}
  66. #tab_res_2 td:nth-of-type(5):before { content: "Stanowisko2"; line-height: 8px;}
  67.  
  68. }


  1. <div id='tab_res'> <div id='tab_res_2'>
  2. <tr>
  3. <th>Login</th>
  4. <th>Imię</th>
  5. <th>Miejcowość</th>
  6. <th>Kod pocztowy</th>
  7. </tr>
  8. </thead>
  9.  
  10. <td>xxx</td>
  11. <td>xxx</td>
  12. <td>xxx</b></td>
  13. <td>xxx</td>
  14.  
  15.  
  16. </div></div>
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 09:20