【发布时间】:2021-03-07 17:40:06
【问题描述】:
我有一个table 和width: 500px。在桌子里面,我有一个孩子有white-space: pre;。
但是,似乎这种组合使得表格的 500px width 被忽略了。
很难描述,所以请查看演示。
https://jsfiddle.net/1fs4zxr2/4/
table {
width: 500px;
background: blue;
}
.codeblock {
background-color: #f3f3f3;
overflow: auto;
white-space: nowrap;
display: block;
max-width: 72%;
width: 100%;
white-space: pre;
}
<table>
<tr>
<td>
<div class="codeblock">
"/oauth2/token?grant_type=refresh_token&refresh_token=" + APP_REFRESH_TOKEN + "&client_id=" + APP_CLIENT_ID + "&client_secret=" + APP_CLIENT_SECRET,
</div>
</td>
</tr>
</table>
无论如何我可以让codeblock 尊重表格的 500 像素宽度吗?
【问题讨论】:
-
你需要表格布局:固定;在桌子上
-
哇哦,这行得通!谢谢!
标签: html css html-table