Alan Alan - 1 year ago 46
CSS Question

How can I create a CSS "well" effect similar to bootstap but deeper?

I would like to create a well area on my page that makes the area look like it is a little bit below the page by a few pixels. My page currently has a white background and a #F5F5F5 well area.

I looked at the well for twitter bootstrap:

http://getbootstrap.com/components/#wells


For me at least this does not look like well at all. Maybe it is because I know the focus of the later version is to create a flat effect.

Does anyone have any examples of how I could add a working well effect?

Answer Source

Using a combination of box shadows, and a sensible colour choice, you can make things look like wells quite easily:

Demo:

div {
  height: 100px;
  width: 200px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  box-shadow: inset 0 0 10px black, 0 0 10px black;
  padding: 10px;
  display: inline-block;
  margin: 15px;
  vertical-align: top;
  text-align: center;
}
html,
body {
  background: gray;
}
.second {
  box-shadow: inset 1px 1px 10px black, 0 0 30px black;
}
.third {
  box-shadow: inset 0px 0px 10px black, 0 0 20px black;
}
.forth {
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 0 30px black;
}
<div>this is deep</div>

<div class="second">I'm slightly different. But still look deep</div>

<div class="third">Don't fall down me!</div>

<div class="forth">Do you, like, wells?</div>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download