我在这里有以下jsfiddle演示:https://jsfiddle.net/gatorreina/0rcev6ux/5/表现得像我想要的那样,因为它会截断列中第一个表的溢出。
但是,当我将完全相同的代码复制并粘贴到dancer2模板中时,我得到以下结果。
<!DOCTYPE html>
<head>
<script src="/javascripts/jquery-1.11.3.min.js"></script>
<script src="/javascripts/bootstrap.min.js"></script>
<script src="/javascripts/jquery.js"></script>
<!-- Latest compiled and minified CSS -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
-->
<!-- for controlling style of numberic sponsor amount field -->
<style>
body{ margin:1em; }
body *{ font-family:sans-serif }
input[type=number]{
font-size:1em;
width:8.5em;
padding:3px;
margin:0;
border:1px solid #000000;
border-radius:5px;
text-align:center;
}
input[type=checkbox]{
font-size:1em;
width:1.5em;
padding:6px;
margin:0;
border:1px solid #000000;
border-radius:10px;
text-align:center;
}
</style>
<!-- table { width: 100%; table-layout:fixed; }
table td { overflow: hidden; } -->
<script>
function validateForm() {
var i;
i=true;
$('.list-group-item').each(function() {
if((!$(this).find('input[type=checkbox]').is(':checked'))&&($(this).find('input[type=number]').val()!="")&&($(this).find('input[type=number]').length)) {
i=false;
}
});
if (!i)
{
alert("You must check the box if you want to sponsor this challenge!");
}
return i;
};
</script>
</head>
<body>
<div class="container" style="margin-top:20px;">
<div class="row">
<div class="col-xs-12">
<form role="form" action="../../openchallenges" method="POST" onsubmit="return validateForm()">
<h4 class="text-center">Heading</h4>
<div class="well" style="max-height: 300px;overflow: auto;">
<ul class="list-group fancy-list-items">
<table style="width: 100%; table-layout: fixed;">
<tr class="list-group-item">
<td style="width:45px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis">I want this column to truncate</td>
<td style="overflow: hidden; text-overflow: ellipsis">This one is fine</td>
</tr>
</table>
</ul>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
标题
I want this column to truncate This one is fine
知道可能是什么问题吗?我正在使用Firefox。
答案 0 :(得分:0)
当我尝试评论<link rel="stylesheet" href="/css/bootstrap.min.css">
它有效时,该列会截断。但是,我需要bootstrap.min.css所以我取消注释并尝试:
.PLRSNAME-col {
/*width: 100%;
min-width: 1px;*/
max-width: 50px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
<td class="PLRSNAME-col">I want this column to truncate</td>
它现在有效 - 列截断。