gpt4 book ai didi

html css 的行为不同于它在 jsfiddle 中的行为

转载 作者:行者123 更新时间:2023-11-28 06:31:00 25 4
gpt4 key购买 nike

我这里有以下 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。

最佳答案

当我尝试注释掉 <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>

现在它可以工作了——列被截断了。

关于html css 的行为不同于它在 jsfiddle 中的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34969485/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com