我有一张桌子:
private void HandleInput()
{
if (detect if physical keyboard here...)
{
if (Input.GetKey(KeyCode.RightArrow))
{
_normalizedHorizontalSpeed = 1;
}
else if (Input.GetKey(KeyCode.LeftArrow))
{
_normalizedHorizontalSpeed = -1;
}
} else if (detect touch screen here...)
{
for (int i = 0; i < Input.touchCount; ++i)
{
if (Input.GetTouch(i).phase == TouchPhase.Began)
{
some code here...
}
}
}
}
&#13;
我希望单元格在某个宽度处断开,以便显示:
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</table>
我尝试使用1 2
3 4
,但无法改变td:nth-child()
的颜色或让它们全部垂直。
感谢您的帮助
答案 0 :(得分:1)
根据需要调整屏幕尺寸,目前设置为768px
HTML:
<table>
<tr class="row1">
<td>1</td>
<td>2</td>
</tr>
<tr class="row2">
<td>3</td>
<td>4</td>
</tr>
</table>
CSS:
@media (min-width: 768px) {
tr {
display: inline-block;
}
}
@media (max-width: 767px) {
tr {
display: block;
}
}
答案 1 :(得分:0)
<table>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</table>