Twitter bootstrap 使td显示为块元素
嘿,程序员们,我有这个表代码,我正在使用twitter引导。 我希望在小屏幕上查看表格时,前两个td保持在线 而第三个td则进入下一条线路;i、 e.Twitter bootstrap 使td显示为块元素,twitter-bootstrap,Twitter Bootstrap,嘿,程序员们,我有这个表代码,我正在使用twitter引导。 我希望在小屏幕上查看表格时,前两个td保持在线 而第三个td则进入下一条线路;i、 e. <my photo> <myname> //the 1st td contains my photo,the second one my name and the <my description> //the 3rd td contains my description but it's on
<my photo> <myname> //the 1st td contains my photo,the second one my name and the
<my description> //the 3rd td contains my description but it's on the next line.
我尝试了很多方法,但是没有办法,我必须寻求帮助。
请协助。您可以按以下方式操作。但是,我不建议更改表的工作方式。可以使用轴网执行相同的操作
<my photo> <myname> //the 1st td contains my photo,the second one my name and the
<my description> //the 3rd td contains my description but it's on the next line.
table{
display:block;
float:left;
clear:both;
}
tr,td{
display: block;
}
td{
width: 50%;
float: left;
}
td.myLast{
width:100%;
float:left;
clear:both
}
您可以使用此
<table class="table">
<tbody>
<tr>
<td>Photo</td>
<td>Name</td>
</tr>
<tr>
<td colspan="2">Description</td>
</tr>
</tbody>
</table>
照片
名称
描述
@Neil,谢谢你的帮助,但由于我有很多td的i,我想我会篡改其他区域的总体布局。现在我这样想。我创建了另一行,它隐藏在大型浏览器中,但在小型浏览器中显示。
以下是示例:
<table>
<tr><td>photo</td><td>name</td><td class="mylast">mydescription</td></tr>
</table>
@media(max-width:767px)
{
td.mylast{display:block;}
}
<table>
<tr><td>photo</td><td>name</td><td class="mylast">mydescription</td></tr>
<tr style="display:none;"><td colspan="3" class="medsmall">mydescription</td></tr>
</table>
@media(max-width:767px)
{
td.mylast{display:none;}
tr.medsmall{display:block;}
}
我不知道您的看法,但如果您不介意的话,我还需要一点澄清:tr不会显示在media small上(在调整浏览器大小时),我想我需要替换一些东西来代替它
tr.medsall{display:block},因为这是告诉tr在block中显示,但不要显示谢谢你的帖子,但那需要两个tr。我希望我们只有一个tr,最后一个td在小屏幕上位于不同的线路上