HTML画布与滚动条 [英] HTML canvas with scrollbar

查看:294
本文介绍了HTML画布与滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在绘制具有大不等宽度的画布图。
每个画布是否可以有自己的滚动条?我试图把所有的画布在一个div和指定一个最大宽度,但它没有工作。
所有的画布都可以在页面的可见宽度上说500px,每个画布都有它的滚动条来查看画布的整个宽度。

I am drawing graphs on canvases which have large unequal widths. Is it possible for each canvas to have its own scrollbar? I tried to put all the canvases in one div and specify a max-width but it didn't work. Is it possible for all the canvases to be say 500px in visible width on the page and each has its scrollbar to view the entire width of the canvas.

谢谢。

推荐答案

指定画布的总宽度然后将其封装在div中。将div设置为 overflow:scroll ,并指定宽度为500px。然后,您应该有滚动条,允许您滚动并查看画布的隐藏部分。对所有画布重复此操作。

Specify the total width of the canvas then wrap it in a div. Set the div to overflow: scroll and give that the 500px width. You should then have scrollbars allowing you to scroll and see the hidden parts of the canvas. Repeat this for all of the canvases.

这篇关于HTML画布与滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆