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;
}
精彩评论