简体   繁体   English

空白:NOWRAP; 问题

[英]white-space:nowrap; issue

I have a table inside of a div, the div width is 100% and table width is 200% with overflow auto. 我在div内有一个表格,使用自动溢出功能,div宽度为100%,表格宽度为200%。 Now the normal behavior is: when the table is displayed user must scroll to right in order to see all table columns. 现在的正常行为是:显示表时,用户必须向右滚动才能查看所有表列。

If I want to set for table th class white-space:nowrap; 如果我想为表格设置class class white-space:nowrap; the div will take a width bigger that ruin my form. div会占用更大的宽度,这会破坏我的表单。

table.grid tr th {
    border-right: 1px solid #FFFFFF;
    white-space: nowrap;
}

Example before adding white-space:nowrap : http://tabletest.orgfree.com/ 添加white-space:nowrap之前的示例white-space:nowraphttp white-space:nowrap

Example after adding white-space:nowrap : http://s7.postimage.org/6rw2idlmj/test.png 添加white-space:nowrap之后的示例: http white-space:nowrap

td.offersContent {
    border: 1px solid #EAEAEA;
    border-radius: 7px 7px 7px 7px;
    margin-bottom: 10px;
    padding: 0 10px;
    width: 83pc;
    *position: absolute;
    display: block;*
 }

this will fix your problem. 这将解决您的问题。

You need to create a wrapper to limit the 100% width 您需要创建一个包装器以限制100%的宽度

see my example i updated the link 看我的例子我更新了链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM