gpt4 book ai didi

html - div 标签内的表格溢出到 div 外部

转载 作者:行者123 更新时间:2023-11-28 15:23:22 24 4
gpt4 key购买 nike

我想将表格保留在 div 标记内,但最后一节的一半丢失了。这是我用过的html结构,

 .dataTable{
table-layout: fixed;
}
.dataTable td{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="row">
<div class="col-md-12">
<table class="dataTable">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
</div>
</div>

</body>
</html>

发布我所面对的 enter image description here

谁能帮我解决这个问题?

最佳答案

试试这个:

.dataTable{
table-layout: fixed;
width: 100%;
}

希望这对你有帮助...

关于html - div 标签内的表格溢出到 div 外部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45673662/

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