宽度过程和溢出滚动

时间:2012-12-12 21:25:51

标签: css scroll width overflow

我有一个div里面有一些代码(比如textarea),我想从父元素修复到99%。没关系,但是如果代码很大,我需要把overflow-x:scroll放到父元素中。

因为我使用宽度:99%,我不能使用overflow-x:scroll。

我不想放宽度:700px或500或者其他什么,因为我现在没有客户端分辨率,我真的希望看到格式宽度作为这个div。

抱歉我的语言不好。

请一些建议?

感谢。

4 个答案:

答案 0 :(得分:0)

抱歉,我忘了白色空间:前。

试试这段代码,你会看到:

<style>
div {width:99%; border:1px solid grey; white-space:pre; overflow:x-scroll}
</style>

<div>
test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test 
</div>

答案 1 :(得分:0)

喜欢这个吗?

div {width:99%; border:1px solid grey; white-space:pre; overflow:auto;}

答案 2 :(得分:0)

    <style>
    div {width:99%;
 border:1px solid grey;
 white-space:pre;
 overflow:x-scroll}
    </style>

    <div>
    test test test test test
    </div>

答案 3 :(得分:0)

请为我的错误感到抱歉,因为我没有提供所有代码。

Stil doesen不工作,因为父元素(table - &gt; td)灵活到:

<style> 
div {width:99%; border:1px solid grey; white-space:pre; overflow:auto;}
</style>

<table cellspacing="0" cellpadding="0">
<tr>
<td> some stuff here </td>
<td>
<div>
test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test 
</div>
</td>
</tr>
</table>

如果有人有其他建议......