Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a CSS "well" effect similar to bootstrap 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?

like image 661
Alan2 Avatar asked Feb 06 '15 13:02

Alan2


People also ask

Can you use CSS and Bootstrap together?

How to Use Bootstrap CSS. In order to use Bootstrap CSS, you need to integrate it into your development environment. To do that, you simply need to create a folder on your computer. In that folder, save your compiled CSS and JS files and a new HTML file where you'll load Bootstrap.

Do you need CSS with Bootstrap?

Bootstrap is a CSS-JS framework. To get the best results you must learn CSS before learning bootstrap. This will give you better understanding to bootstrap because it is nothing but readymade CSS. There will come a time when you must write your own CSS.

Is Bootstrap heavy?

Bootstrap sites can be heavy So, if you use this popular front-end UI library in your project, make sure you pay extra attention to page weight and page speed.


2 Answers

You can simply inspect bootstrap well example and copy ".well" rule set

Demo:

.well {
    min-height: 20px;
    padding: 19px;
    margin-bottom: 20px;
    background-color: #f5f5f5;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.05);
    box-shadow: inset 0 1px 1px rgba(0,0,0,.05);
}
<div class="well">
  Some Text
</div>
like image 172
Ammar Hasan Avatar answered Nov 16 '22 00:11

Ammar Hasan


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>
like image 32
jbutler483 Avatar answered Nov 16 '22 01:11

jbutler483