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 |
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>無題ドキュメント</title> <style> body { font-family: "Hiragino Kaku Gothic Pro N", Meiryo, sans-serif; } table { border-collapse: collapse; border: 1px solid coral; } th, td { width: 100px; border: 1px dotted coral; } th { background: lightpink; } td { text-align: center; } </style> </head> <body> <table> <?php $foods = array( '果物' => array('いちご','りんご','バナナ'), '野菜' => array ('キューリ','かぼちゃ','ジャガイモ') ); foreach($foods as $key => $value){ foreach($value as $category => $name){ echo '<tr>'; echo '<th>' . $key . '</th><td>' . $name . '</td>'; echo '</tr>'; } } ?> </table> </body> </html> |