I would like to draw a box like this:

enter image description here

I'm especially interested in both

  1. how to draw a shadow that comes out from the sides only (not also top or bottom) and
  2. how to draw two shadows, the bigger left-right shadow and the smaller outline border one.

I've tried many approaches but it seems I'm completely off track here since I can't even draw the left-right bigger shadow, so I would appreciate if someone could explain me where to start here.

Clarifications. I think the picture is compose by 4 parts:

1) the background (uninteresting here)

2) the white rectangle

3) the rectangle borders-edges (what I previously referred as the smaller shadow) with a ridge like effect

4) the left and right shadows

I'm trying to draw parts 3 and 4.

  • The smaller outline border shadow? Where? (Do you mean the slightly darker edges on the rectangle?) I can only see the one at the left and right. – Qrrbrbirlbel Oct 27 '13 at 16:07
  • @Qrrbrbirlbel I added a small clarification, BTW it's like you said, I was referring to the edges. – knut Oct 27 '13 at 16:42

Some ideas, lots of hardcoded magic numbers (found by trial and error):


\usetikzlibrary{backgrounds, calc, shadows, shadows.blur}

    % #1: Optional aditional tikz options
    % #2: Name of the node to "decorate"
           rounded corners=1pt,
           blur shadow={shadow xshift=0pt,
           shadow yshift=-0.3pt,
           shadow blur steps=6,
           shadow blur radius=.6pt}, #1]
            ($(#2.north west)+( 0.3pt,0)$) --
            ($(#2.south west)+( 0.3pt,0)$) --
            ($(#2.south east)+(-0.3pt,0)$) --
            ($(#2.north east)+(-0.3pt,0)$) --
        \path[rounded corners,
           blur shadow={shadow xshift=0pt,
           shadow yshift=0pt,
           shadow blur steps=8,
           shadow blur radius=2pt}, #1]
            ($(#2.north west)+(-1pt,-2pt)$) --
            ($(#2.south west)+(-1pt, 2pt)$) --
            ($(#2.south east)+( 1pt, 2pt)$) --
            ($(#2.north east)+( 1pt,-2pt)$) --

    \fill[black!20] (-3,-1) rectangle (3,1);
    \node[fill=white, rectangle, minimum width=3cm, minimum height=1cm]
       (example) {Test};




An idea that needs xscale around and yscale around. Better results can probably achieved with a custom fading that works similar to circle with fuzzy edge XX percent (see circular shadow and circular glow) but for rectangles.


\documentclass[tikz,border={3pt 0pt 3pt 0pt}]{standalone}
  xscale around/.code=%
  yscale around/.code=%
  shadow xscale/.initial=1, shadow yscale/.initial=1,
  shadow scale/.style={shadow xscale={#1}, shadow yscale={#1}},
  general shadow/.style={
      transform canvas={
        xscale around=%
          \pgfkeysvalueof{/tikz/shadow xscale}:(current path bounding box.center),
        yscale around=%
          \pgfkeysvalueof{/tikz/shadow yscale}:(current path bounding box.center),
          {(\pgfkeysvalueof{/tikz/shadow xshift},\pgfkeysvalueof{/tikz/shadow yshift})}
  my shadow/.style={general shadow={
      shadow xscale=1.1, shadow yscale=.9, opacity=.75, top color=gray!10,
      bottom color=gray!10, middle color=gray!50, every shadow, #1}}}
\begin{tikzpicture}[start chain=ch0 going below, node distance=.2cm,
                    nodes={draw, fill=white, my shadow, on chain=ch0}]
\node                     {Effect 8};
\node[minimum height=+2cm]{Effect 9};
\node[minimum width =+2cm]{Effect 10};


enter image description here

  • 1
    this works "in principle", but the result is very far from the original picture. I was looking to fully reproduce it. – knut Oct 29 '13 at 12:51

Still far away from expected results but here it is another approximation with tcolorbox



\tcbset{width=.5\linewidth, height=3cm, valign=center, center upper, sharp corners, enhanced, frame hidden, fontupper=\sffamily\Huge,colback=white,
fuzzy halo=.1pt with black!35,
overlay unbroken={
\shade[left color=black!30] ([yshift=-3mm]frame.north east) 
sin +(1mm,-1.5mm) cos +(1mm,-1.5mm)--
([xshift=2mm,yshift=6mm]frame.south east)
sin +(-1mm,-1.5mm)  cos +(-1mm,-1.5mm);
\shade[right color=black!30, left color=white] ([yshift=-3mm]frame.north west) 
sin +(-1mm,-1.5mm) cos +(-1mm,-1.5mm)--
([xshift=-2mm,yshift=6mm]frame.south west)
sin +(1mm,-1.5mm)  cos +(1mm,-1.5mm);

Effect 8


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.