is it possible to give the shadow inside the container? - html

.part-two{
float: left;
height:300px;
width: 200px;
background-color:green;
box-shadow: -10px -10px 1px red;
}
<div id="part-two" class="part-two">
</div>
in the above code i have given an outer shadow using box-shadow property,instead of that i want to give the shadow on inside of the container,is it possible to give inner shadow using box-shadow method?if yes,how?
else ,is there any methods exists to giver inner shadow using css?

Yes it is possible to add inner-shadow to an element, you just need to add inset along with your properties in box-shadow.
The presence of the inset keyword changes the shadow to one inside the
frame (as if the content was depressed inside the box). Inset shadows
are drawn inside the border (even transparent ones), above the
background, but below content.
.part-two{
float: left;
height:300px;
width: 200px;
background-color:green;
box-shadow: inset 0px 1px 10px 20px orange;
}
<div id="part-two" class="part-two">
</div>

Use this box-shadow: 10px 10px 0px 0px red inset;
.part-two{
float: left;
height:300px;
width: 200px;
background-color:green;
box-shadow: 10px 10px 0px 0px red inset;
}
<div id="part-two" class="part-two">
</div>

used to this
box-shadow:inset 5px 5px 1px red, inset 15px 15px 1px yellow;
inset as like this
.part-two{
float: left;
height:300px;
width: 200px;
background-color:green;
box-shadow:inset 5px 5px 1px red, inset 15px 15px 1px yellow;
}
<div id="part-two" class="part-two">
</div>

you looking for something like this?
.part-two
{
float: left;
height:300px;
width: 200px;
background-color:green;
box-shadow: -10px -10px 1px red;
-moz-box-shadow: inset 0 0 10px red;
-webkit-box-shadow: inset 0 0 10px red;
box-shadow: inset 0 0 10px red;
}
<div id="part-two" class="part-two">
</div>

Try this:
.part-two{
float: left;
height:300px;
width: 200px;
background-color:green;
box-shadow: inset -10px -10px 1px red;
}

Related

how i can put the shadow inset from one side

i want the shadow to appear in one side (Top) with css only,
i have tried many solutions but always there is a shadow in all sides
this is my try
.box-container{
width:100%;
height: 80px;
padding:10px 10%;
background-color: #f00;
}
.box-inner{
width:80%;
height: 100%;
background-color: #ff0;
box-shadow: inset 0 5px 5px rgba(0,0,0,0.5);
}
<div class="box-container">
<div class="box-inner"></div>
</div>
Try to use this:
.box-container{
width:100%;
height: 80px;
padding:10px 10%;
background-color: #f00;
}
.box-inner{
width:80%;
height: 100%;
background-color: #ff0;
box-shadow: inset 0 20px 20px -20px rgba(0,0,0,0.8);
}
<div class="box-container">
<div class="box-inner"></div>
</div>
Please do try this box-shadow: inset 0 7px 9px -7px rgba(0,0,0,0.7); for only top
Think this will help you...
try to use this
.box-container{
width:100%;
height: 80px;
padding:10px 10%;
background-color: #f00;
}
.box-inner{
width:80%;
height: 100%;
background-color: #ff0;
-moz-box-shadow: inset 0 8px 8px -8px rgba(0,0,0,0.8);
-webkit-box-shadow: inset 0 8px 8px -8px rgba(0,0,0,0.8);
box-shadow: inset 0 8px 8px -8px rgba(0,0,0,0.8);
}
<div class="box-container">
<div class="box-inner"></div>
</div>
Have a look at http://www.css3.info/preview/box-shadow/ for more information about box-shadow.
Hope this was what you were looking for!

CSS box-radius ruins box-shadow inset effect on firefox

I have a div tag that I want to style with rounded top corners. And, I am facing an issue with my box-radius.
.box {
width: 100px;
height: 100px;
-webkit-box-shadow: inset 0 20px 3px 1px #4D7594;
box-shadow: inset 0 20px 3px 1px #4D7594;
border-radius: 15px;
}
<div class="box">
</div>
Well, so far works good. But in this sample, if I add more px to my border-radius, it will break the inset of box-shadow.
.box {
width: 100px;
height: 100px;
-webkit-box-shadow: inset 0 20px 3px 1px #4D7594;
box-shadow: inset 0 20px 3px 1px #4D7594;
border-radius: 16px;
}
<div class="box">
</div>
You may notice that on the top area of the .box seems to have its shadow missing. This behavior only happens on firefox. And currently, I am using firefox 45.0.1.
Setting two shadows seems to fix it at this time :
.box {
width: 100px;
height: 100px;
-webkit-box-shadow: inset 0 20px 3px 1px #4D7594;
box-shadow: inset 0 18px #4D7594, inset 0 20px 3px 1px #4D7594;
border-radius: 16px;
}
<div class="box">
</div>

Fancy Border With CSS3

I want to create something like this with CSS only, is it possible?
div {
height: 50px;
width: 200px;
background: #006B96;
box-shadow: 0px 0px 0px 4px #006B96;
border: 4px solid #fff;
margin: 0 auto;
border-top-left-radius: 5px;
border-bottom-right-radius: 5px;
}
<div>
</div>
div{
height:50px;
width:200px;
background:#006B96;
box-shadow:0px 0px 0px 4px #006B96;
border:4px solid #fff;
margin:0 auto;
}
<div>
</div>
span {
display:inline-block;
padding:5px;
box-shadow:
0px 0px 0px 5px #000,
0px 0px 0px 10px #fff,
0px 0px 0px 15px #000;
}
http://jsfiddle.net/gwhq3uk6/
Try to go with Bootstrap and you will no longer have to worry about designing buttons because it is much easier get all kind of buttons and other stuff you need without writing a single line of code.

Image box shadow border styling in CSS

I would like to achieve a CSS border similar to the one seen around the Tim Cook image on this page: http://www.macstories.net/news/tim-cook-at-d11/ — however, I would only like the border around images in the body text on my own site, not, for instance, images in the sidebar of my site.
What code would I need to achieve the cool border, and how can I target only images in the body text?
If your "body text" is, say, in a div classed as "main", you can target the images just in that section like so:
.main img {
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 0 5px rgba(0,0,0,0.2);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
margin: 30px 0;
padding: 10px;
background: #FFF;
border: 1px solid #CCC;
position: relative;
display: block;
}
img{
-webkit-box-shadow:0 0px 7px rgba(0,0,0,0.3);
box-shadow:0 0 5px rgba(0,0,0,0.2);
padding:10px;
background:#fff;
border:1px solid #ccc;
width:auto;
height:auto;
}
Well i think it would be something like this for just a generic shadow effct.
The HTML:
<div id="example" class="outerglow">Full Shadow</div>
The CSS:
#example {
font-size: 1.4em;
color: #CCCCCC;
line-height: 40px;
text-align: center;
background-color: #333333;
margin: 25px auto;
padding: 5px 10px;
height: 40px;
width: 80%;}
.outerglow {
box-shadow: 0px 0px 3px 2px rgba(0,0,0,0.6);
-moz-box-shadow: 0px 0px 3px 2px rgba(0,0,0,0.6);
-webkit-box-shadow: 0px 0px 3px 2px rgba(0,0,0,0.6);}
and here is the jsfiddle to look see..
http://jsfiddle.net/KMtc6/
Forgive me if my code is sloppy or jumbled.

CSS - Corner Radius with Box Shadow Inset, ugly corners

When I try to apply a box shadow to my element that has a 3px border radius I get ugly corners with pixels of the elements background.
HTML
<div id="wrapper">
</div>
CSS
body {
background: #fff;
}
#wrapper {
background: black;
width: 300px;
height: 300px;
margin: 40px auto;
border-radius: 3px;
-moz-box-shadow: inset 0 0 5px 4px yellow;
-webkit-box-shadow: inset 0 0 5px 4px yellow;
box-shadow: inset 0 0 5px 4px yellow;
}
JSFIDDLE
http://jsfiddle.net/PCzFC/1/
If you look at the fiddle you see that the black background is in the corners. Is it supposed to be like this or is it a bug? I use Firefox.
This is a known bug in Google Chrome, perhaps it's present in Firefox as well.
http://code.google.com/p/chromium/issues/detail?id=29427
You can create the same effect without the inset. Make a yellow wrapper around it.
body {
background: #fff;
}
#wrapper {
background: black;
width: 290px;
height: 290px;
border-radius: 3px;
-moz-box-shadow: 0 0 5px 1px black;
-webkit-box-shadow: 0 0 5px 1px black;
box-shadow: 0 0 5px 1px black;
margin: 5px;
}
.yellow {
background: yellow;
border-radius: 6px;
overflow: hidden;
width: 300px;
height: 300px;
margin: 40px auto;
}​
<div class="yellow">
<div id="wrapper">
</div>
</div>
http://jsfiddle.net/PCzFC/65/
What shadow: inset does is to add shadows inside the box. If you remove inset on all the box shadows, the shadows will move to the outside of the box.
it is not a bug this will happen because you use inset shadow effect and if you can understand css then inset meaning is inside so it's normal if u remove inset from your code then it should be look fine or if you need shadow effect inside the box then you have to choose color and matched it to box color
or you can remove border radius from your code then it should be look fine
#wrapper {
background: black;
width: 300px;
height: 300px;
margin: 40px auto;
-moz-box-shadow: inset 0 0 5px 4px yellow;
-webkit-box-shadow: inset 0 0 5px 4px yellow;
box-shadow: inset 0 0 5px 4px yellow;
}