I created a bootstrap grid table which contains very long texts sometimes. Problem: if a text is too long then my table rows height changes as you can see in my example code. I want to hide the text instead.
/* Optional theme */
@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');
.zeile {
border: 1px solid red;
overflow:hidden;
}
.row {
margin-left: 0px;
margin-right: 0px;
display:table;
width:100%;
}
.row .col-xs-2 {
display:table-cell;
float:none;
}
.row .col-xs-5 {
display:table-cell;
float:none;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-xs-2 zeile" id="too_long">
Very long text Very long text Very long
</div>
<div class="col-xs-5 zeile">
Text
</div>
<div class="col-xs-5 zeile">
Text
</div>
</div>
<div class="row">
<div class="col-xs-2 zeile">
short text
</div>
<div class="col-xs-5 zeile">
Text
</div>
<div class="col-xs-5 zeile">
Text
</div>
</div>
JSFIDDLE: https://jsfiddle.net/5L2w4yvr/
4
Answers
Try This
Note: I changed the layout from the one made out of divs to the table layout.
When you are using Bootstrap it’s important that you never change its original css, at least not for the grid system itself as it will most likely result in problems later.
CSS:
Table grid:
jsFiddle
Solution 1:
it works but it has fixed width: jsfiddle
Solution 2: it works without fixed width : jsfiddle
Have a look