Rob
Rob

Reputation: 3574

Div getting larger instead of scrollbar on page

I've created a website with a content-width of 800px.

However, when my user uploads a picture with a width of 900px, the site is totally out of order. Is there a way to add a slider or scrollbar instead of the div getting bigger, when the images are too large for the website? If not, I think I have to resize the uploaded images..

Thanks in advance.

Upvotes: 0

Views: 328

Answers (3)

BJack
BJack

Reputation: 2534

I assume that because you're talking about width, that you're wanting the content width to maintain at 800px and then default to scroll if content (in this case an image) is > 800px.

Perhaps you could take advantage of the overflow-x: scroll; property in CSS to only scroll horizontally. overflow: auto; may add the vertical scroll as well when not required.

Upvotes: 1

muneebShabbir
muneebShabbir

Reputation: 2528

put style="overflow:auto;" on your div then it will produce a scroll bar when image is larger than your space

Upvotes: 2

Andrew
Andrew

Reputation: 1880

You may need to supply a little bit of the code that you are using so we can figure out the problem, but what you could use is:

overflow: hidden;

That will stop anything being wider than your 800px content container.

Upvotes: 0

Related Questions