hw06_19.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <header>
  2. <h1>For Table Horizontal</h1>
  3. </header>
  4. <body>
  5. <style>
  6. td {
  7. padding: 5px;
  8. }
  9. td,
  10. th {
  11. border: 1px solid #999;
  12. border-top-color: rgb(153, 153, 153);
  13. border-top-style: solid;
  14. border-top-width: 1px;
  15. border-right-color: rgb(153, 153, 153);
  16. border-right-style: solid;
  17. border-right-width: 1px;
  18. border-bottom-color: rgb(153, 153, 153);
  19. border-bottom-style: solid;
  20. border-bottom-width: 1px;
  21. border-left-color: rgb(153, 153, 153);
  22. border-left-style: solid;
  23. border-left-width: 1px;
  24. border-image-source: initial;
  25. border-image-slice: initial;
  26. border-image-width: initial;
  27. border-image-outset: initial;
  28. border-image-repeat: initial;
  29. }
  30. td {
  31. display: table-cell;
  32. vertical-align: inherit;
  33. }
  34. table {
  35. border-collapse: collapse;
  36. text-indent: initial;
  37. border-spacing: 2px;
  38. }
  39. </style>
  40. <script>
  41. const names = ["John", "Paul", "George", "Ringo"];
  42. let str = "<table><tbody><tr>";
  43. for (let name of names) {
  44. // YOUR MAGIC HERE
  45. str += `<td><section>${name}</section></td>`;
  46. }
  47. str += "</tr></tbody></table>";
  48. document.write(str);
  49. </script>
  50. </body>