我需要在页面上显示日志,但是日志有很长的行(它是一个apache access_log),它既丑陋又难以理解。
如何使用水平滚动条显示内容?
我正在使用bootstrap并尝试使用overflow : auto/scroll
并修复高度/宽度但没有成功。
编辑: 这是我的代码
<div class="well" style="overflow-x: scroll;width:200px;" >
<?php
echo $log;
?>
</div>
$ log包含新行<{1}}
答案 0 :(得分:1)
<div style="overflow-x: scroll;white-space:nowrap;width:200px;
height:200px;border:1px solid red" >
A Very long line gjkdddddssssss sssssssssssssssssssss ssssssssssss
ssssssssssss ssss
ssssssss
ssssssssssssss sssssssssssssssssssssssss ss
sssssssssssssssssss ssssssssssssssssssssssss
</div>
White-Space是您需要设置的属性。
答案 1 :(得分:0)
答案 2 :(得分:0)
你现在习惯了这个
<强> HTML 强>
<div class="ok">heli msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample helo i msample </div>
<强>的CSS 强>
.ok{
background:red;
width:200px;
height:200px;
overflow:scroll;
word-break: break-all;
}
的 Demo 强> 的
答案 3 :(得分:0)
要防止换行使用:
CSS
p {
white-space: nowrap;
}
然后您可以使用overflow
属性控制滚动。