Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

overflow on parent div prevent box-shadow to display

Tags:

html

css

I have a <table> with a soft box-shadow and I want to wrap it inside a <div> so that I can make the content overflow on x-axis (the real table is large, I need this effect in smaller screen).

It's straightforward but when I add the CSS property overflow-x: auto; on the wrapper <div> the box-shadow is not yet displayed correctly (only the right side box-shadow is visible, and only in larger screen).
Please refer to this JSbin example where the first table is the correct visualization while the second one has the glitch.

How can I solve the problem without removing the overflow property?

like image 755
Naigel Avatar asked Jan 06 '17 09:01

Naigel


1 Answers

You can add padding for parent same size as shadow.

like image 104
Justinas Avatar answered Oct 03 '22 06:10

Justinas