6

I want to accomplish a preview of an image gallery that is wider than the screen, using overflow: scroll (or auto). To the right, a shadow that overlaps the last visible image should indicate that more images are visible to the right.

Here is a Fiddle: http://jsfiddle.net/SBdLg/

First, I thought: Easy, give that image gallery a box-shadow: inset. But that will be shown behind the images. Now, with an overlapping div that has position: absolute, I reach the desired effect BUT the box-shadow also moves when scrolling to the right.

IMHO, this problem would also occur when using an image containing the shadow instead of the div on top.

Is the desired effect possible by CSS at all?

1 Answer 1

1

Removing position: relative from the outer DIV and positioning the shadow precisely where you need it (this is the ugly bit) will help you achieve this.

Check the demo: http://jsfiddle.net/SBdLg/11/

Sign up to request clarification or add additional context in comments.

2 Comments

Updated the demo to add a further outer DIV with position: relative so that you can move the gallery around without messing with the position of the shadow each time.
Thanks, removing the position: relative and adding one more div around it helped :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.