开发者

Prevent HTML <img> tags from Wrapping

I have JavaScript that dynamically creates many <img> tags and appends them to various divs.

I want to prevent these images from wrapping. That is, wh开发者_Go百科en the screen resolution is not enough to contain them, the browser should create horizontal scroll-bars instead of wrapping.


Add the following CSS to the div containing the img tags:
overflow-x: auto; white-space: nowrap;
in order to get a horizontal scrollbar when the content is wider than the div and to prevent the content from wrapping.


in CSS

div {
 overflow: auto;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜