Simple fluid drop shadows

Pre 2006

Narrow

This is the text that goes in the middle.

Medium

Another box that has a bit more text so that the box will be taller and the shadow stretches to suit.

Wide

One more text box that has a lot more text so that the box will be even taller and the shadow will still shadow to suit. The shadow color can be matched to the background and can also be positioned to the left or right.

Can be applied to images

architecture

A left positioned shadow

Medium

and finally a text box with a surround shadow.

A raised box

copyright © stu nicholls - CSS play

Information

Nothing fancy or complicated this time. Just a simple way of producing drop shadows that are fluid and require NO graphics.

Cascading Style Sheet

.out {
  display:block; 
  background:#bbb; 
  border:1px solid #ddd; 
  position:relative;
  margin:1em 0;
  }
.in {
  text-align:center; 
  background:#fff; 
  border:1px solid #555; 
  position:relative; 
  padding:5px;
  font-weight:normal;
  }
.ltin {
  left:-5px;
  }
.tpin {
  top:-5px;
  }
.narrow {width:8em;} /* change to suit */
h4 {font-weight:bold; color:#000;}

xhtml

<div class="out narrow">
  <div class="in ltin tpin">
    <h4>Narrow</h4>
    <p>This is the text that goes in the middle.</p>
  </div>
</div>

Again, now that we have box shadow styles this is more or less redundant.


Copyright

You may use this method on your personal 'non-profit' web site without seeking my permission. A link back to CSSplay is always appreciated.

Commercial usage is also permitted without seeking approval, but I would ask that a donation is considered to support my work on CSSPlay.

If you are having problems integrating any of my demonstrations into your website then I now offer a service to fault find and correct any errors that you may have introduced. Please email me for more information.


Please ask permission before using or copying this example to your web site.


Please Support CSS play

Please note that if your donation is for a demo/menu then you will need to email me with the url of the demo/menu after making the donation

For more CSS demonstrations I recommend that you visit the Dynamic Drive CSS Library.


Free, practical CSS menus, layouts, and examples

Follow CSS play


Facebook   Twitter   Facebook Fan Page