So I have created a box in css like this:
#box
{
background-color: #5d5d5d;
border-radius: 2px 2px 2px 2px;
box-shadow: 5px 5px 2px #767676;
height: 200px;
width: 1100px;
}
with the result of
What I want to do without overlaying a smaller whitebox, and without messing up the shadow effect is something like this:
Is this possible, or am I going to have to just add a smaller whitebox over the top and play with the layering and shadow effects until they’re about right?
Or maybe there is a way using JavaScript or something like that?
NB: What I don’t want to do is just create the box in photoshop as this will slow overall load time of the page
4
Answers
You can create an
::after
pseudo-element with a white background, float it right and offset it to move over the shadow:option:1 boxshadow
option:2 pseudo element see @Fahad Hasan
You can use the
:before
pseudo-element to achieve what you’re trying to do like this: DEMO. This is the CSS which I’ve added:You should try with pseudo elements, this is an example:
HTML:
CSS:
Here is a demo