表比Bootstrap列容器宽 [英] Table wider than Bootstrap column container
本文介绍了表比Bootstrap列容器宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< div class =row>
< div class =col-md-4>
< table class =table>
< tbody>
<%@ user.each do | user | %GT;
< tr>
< td><%= user.content%>< / td>
< / tr>
<%end%>
< / tbody>
< / table>
< / div>
< / div>
问题是如果我有一个非常大的内容并且有很多字符,表格变得比它的容器< div class =col-md-4>
。如何完成它的内容包装到另一行并且不打破布局?感谢您的帮助!
解决方案
尝试添加 word-wrap
和 word-break
td {
word-wrap:打破字;
word-break:全部破解;
}
以下是您更新的 Bootply
Can someone explain to me why is this happening? I've wrapped my content inside Bootstrap responsive divs and my table which is inside that div has bigger width than container.
<div class="row">
<div class="col-md-4">
<table class="table">
<tbody>
<% @user.each do |user| %>
<tr>
<td><%= user.content %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
The problem is if I have one really big content with a lot of characters, table becomes much wider than it's container <div class="col-md-4">
. How to accomplish that it's content wraps to another row and not break a layout? Thank you for your help!
解决方案
Try adding word-wrap
and word-break
td {
word-wrap:break-word;
word-break:break-all;
}
Here's your updated Bootply
这篇关于表比Bootstrap列容器宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文