具有垂直< tr>的HTML表格和PHP数组 [英] Html table with vertical <tr> and PHP arrays
问题描述
我有一个PHP数组,我想通过它递增并在表中输出信息.唯一的问题是HTML表的组织方式.我想垂直输出数据.
I have a PHP array that I want to increment through and output the information in a table. The only problem is the way HTML tables are organized. I want to output the data vertically.
例如-第一行显示一周中的每一天,然后在每一天的下方垂直显示某些餐厅提供的食物.从一周的每一天开始,它将显示5道菜.
For example - the first row shows every day of the week, then below each day it would show vertically what food some restaurant is serving. It would show 5 dishes straight down from each day of the week.
由于表被分为<tr>
(水平),然后是<td>
,因此仅提供水平输出.因此,我想到答案的唯一方法是PHP答案或CSS/html答案.
Since tables are separated into <tr>
(horizontal) and then <td>
that only gives you horizontal output. So the only way I can think of an answer is either a PHP answer or a CSS/html answer.
Example:
TR - TD - TD - TD
TR - TD - TD - TD
TR - TD - TD - TD
有没有办法让<tr>
垂直显示然后再由<td>
水平分隔?
Is there a way to have <tr>
display vertically and then be seperated by <td>
horizontally?
Example like this:
TR TR TR
| | |
TD TD TD
| | |
TD TD TD
推荐答案
弄清楚了.如果将display: block
添加到<td>
元素,则它们开始彼此堆叠.也许我只是精疲力尽,想了答案...谢谢
Figured it out. If you add display: block
to the <td>
elements then they start stacking on top of each other. Maybe im just burnt out and over thought the answer... Thanks anways
这篇关于具有垂直< tr>的HTML表格和PHP数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!