Add shadows in the dropdown menu - css

i am trying to add shadows at here: http://prntscr.com/eiyg7i
But i cant figure that out.
I've added this code:
.nav-dropdown {
box-shadow: none;
}
but it just make the box shadow to none.
Edit: i have added this code
.nav-dropdown {
-webkit-box-shadow: 2px 6px 21px -2px rgba(0,0,0,0.75);
-moz-box-shadow: 2px 6px 21px -2px rgba(0,0,0,0.75);
box-shadow: 2px 6px 21px -2px rgba(0,0,0,0.75);
}
but it still gets wrong http://94.247.169.169/~welloteket/ - it still get shadows here at the top

You can offset the box-shadow in horizontal and vertical direction. Unfortunately doing so will make the shadow appear more prominent on the side you shift it to.
Would this work for you?
http://codepen.io/connexo/pen/gmWjNJ
.bar {
background-color: #f8f8f8;
height: 60px;
}
.dropdown {
height: 200px;
width: 400px;
margin: 0 auto 50px;
box-shadow: 0 10px 10px #666;
/* | | |
x-shift | |
y-shift |
size of shadow
*/
}
/* This uses z-index
.bar2 {
background-color: #f0f0f0;
height: 60px;
z-index: 2;
position: relative;
}
.dropdown2 {
height: 200px;
width: 400px;
margin: 0 auto 50px;
box-shadow: 0 0 10px #666;
}
<div class="bar"></div>
<div class="dropdown"></div>
<div class="bar2"></div>
<div class="dropdown2"></div>

Related

box shadow to left and right doesn't work

I want to make box-shadow to the left and right sides,however there is alway a shadow in the top of the box,I have checked my code many times.
#box {
margin: 0 auto;
margin-top: 0px;
border: 1px solid #ffffff;
border-top-color: #e99f2e;
overflow: hidden;
box-shadow: 2px 0 20px 2px #7f7e7f, -2px 0 20px 2px #7f7e7f;
}
<div id="box"></div>
First understand the syntax of box-shadow and then it get's easy to apply box-shadow at any side as you have planned your design,
syntax -
box-shadow : offset-x | offset-y | blur-radius | spread-radius | color
#box {
margin: 0 auto;
margin-top: 0px;
overflow: hidden;
box-shadow: -10px 0 2px -2px #7f7e7f, 10px 0 2px -2px #7f7e7f;
height: 150px;
width: 50%;
background:#cff;
margin-top:20px;
}
<div id="box"></div>
There is a hack actually.
You can achieve this by adding an "empty" top and bottom shadow.
box-shadow: 0 9px 0px 0px white, 0 -9px 0px 0px white, 12px 0 15px -4px rgba(30, 53, 125, 0.9), -12px 0 15px -4px rgba(30, 53, 125, 0.9);
I don't think this is as good as the other answers, but this is an alternative approach using absolute positioned pseudo elements with shadows.
.lr-shadow {
background:#fff;
border: 1px solid #fff;
border-top-color: #e99f2e;
width:100%;
max-width:500px;
height:200px;
position:relative;
margin:0 auto;
}
.lr-shadow:before, .lr-shadow:after {
box-shadow: 0 0 20px 2px #7f7e7f;
content:" ";
position:absolute;
top:50%;
transform:translateY(-50%);
height:90%;
z-index:-1;
}
.lr-shadow:before {
left:5px;
}
.lr-shadow:after {
right:5px;
}
<div class="lr-shadow"></div>
You can achieve this effect if you set the spread to the negative of blur parameter. For the left box shadow, set position to negative blur and the right box shadow, position to positive blur. I used 20px in this demo:
#box {
margin: 0 auto;
margin-top: 40px;
border: 1px solid #ffffff;
border-top-color: #e99f2e;
overflow: hidden;
width: 150px;
height: 150px;
box-shadow: 20px 0px 20px -20px #7f7e7f, -20px 0px 20px -20px #7f7e7f;
}
<div id="box"></div>
Check out this CSS Box-shadow generator to explore further.

CSS Shadow get all div bottom width?

I want a box BOTTOM shadow to get all the div #menu width, but the shadow is letting a left and right margin... What should I change to get the full #menu bottom shadow without that margin?
#menu{
width:500px;
height:50px;
background-color:red;
box-shadow: 0 6px 2px -2px #555;
}
https://jsfiddle.net/c6zkLngz/
thank you friends!
The syntax for box-shadow is: (MDN)
/* offset-x | offset-y | blur-radius | spread-radius | color */
You are setting the spread-radius to -2px. If you reset that to 0 you'll get the box-shadow on the full width.
#menu{
width:500px;
height:50px;
background-color:red;
box-shadow: 0 6px 2px 0 #555;
}
#menu {
width: 500px;
height: 50px;
background-color: red;
box-shadow: 0 6px 2px 0 #555;
}
<div id=menu></div>
If necessary, you could then adjust the blur-radius... something like this.
Alternatively, (and only if it's feasible) you could whack left and right white borders on the element... something like this
#menu {
width: 500px;
height: 50px;
background-color: red;
box-shadow: 0px 6px 2px -2px #555;
box-sizing: border-box;
border-left: 1.8px solid white;
border-right: 1.8px solid white;
}
<div id=menu></div>

CSS vertical scrollbar padding left/right in UL possible?

Is it possible to add padding or margin around the scrollbar item or scrollbar-track? I've tried and can only get padding top/bottom. Adding padding to the UL has no effect on scrollbar. Negative margins on scrollbar have no effect. Ideas? JS Fiddle here.
::-webkit-scrollbar {
width: 12px;
margin:10px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-border-radius: 10px;
border-radius: 10px;
padding: 10px
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: rgba(255,0,0,0.8);
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(255,0,0,0.4);
You can see an example below, basically forget adding margin or padding there, just increase the width/height of scroll area, and decrease the width height of thumb/track.
Quoted from how to customise custom scroll?
body {
min-height: 1000px;
font-family: sans-serif;
}
div#container {
height: 200px;
width: 300px;
overflow: scroll;
border-radius: 5px;
margin: 10px;
border: 1px solid #AAAAAA;
}
div#content {
height: 1000px;
outline: none;
padding: 10px;
}
::-webkit-scrollbar {
width: 14px;
}
::-webkit-scrollbar-thumb {
border: 4px solid rgba(0, 0, 0, 0);
background-clip: padding-box;
border-radius: 9999px;
background-color: #AAAAAA;
}
<div id="container">
<div id="content" contenteditable>
Click to type...
</div>
</div>
I created a margin-right effect using border-right on the scrollbar-thumb:
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-thumb {
background: red;
border-right: 4px white solid;
background-clip: padding-box;
}
The scrollbar appears to have width 4px and margin-right 4px.
Here's a fiddle as well: https://jsfiddle.net/4kgvL93h/3/
You can add a margin to the scrollbar track;
#someID ::-webkit-scrollbar-track{
border-radius: 15px;
margin: 40px;
box-shadow: inset 7px 10px 12px #f0f0f0;
}
This solution make a real space between content and scrollbar (if a scrollable element doesn't have a transparent background). Useful for window scrollbars.
.scroll {overflow:auto;}
.scroll::-webkit-scrollbar {
width:16px;
height:16px;
background:inherit;
}
.scroll::-webkit-scrollbar-track:vertical {
border-right:8px solid rgba(0,0,0,.2);
}
.scroll::-webkit-scrollbar-thumb:vertical {
border-right:8px solid rgba(255,255,255,.2);
}
.scroll::-webkit-scrollbar-track:horizontal {
border-bottom:8px solid rgba(0,0,0,.2);
}
.scroll::-webkit-scrollbar-thumb:horizontal {
border-bottom:8px solid rgba(255,255,255,.2);
}
.scroll::-webkit-scrollbar-corner,
.scroll::-webkit-resizer {background:inherit;
border-right:8px solid rgba(255,255,255,.2); //optional
border-bottom:8px solid rgba(255,255,255,.2); //optional
}
Simply use the margin-block
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px F2F2F2;
border-radius: 0px;
margin-block: 15px;
}
#container{
height:400px;
background-color:white;
overflow-y:scroll;
border-radius:25px;
}
#content{
height:700px;
background-color:yellow;
padding:25px;
}
::-webkit-scrollbar{
width: 5px;
}
/* Track */
::-webkit-scrollbar-track{
box-shadow: inset 0 0 5px F2F2F2;
border-radius: 0px;
margin-block: 25px;
}
/* Handle */
::-webkit-scrollbar-thumb{
background: #8B8B8B;
border-radius: 27px;
border: 4px solid rgba(0, 0, 0, 0);
}
<div id="container">
<div id="content">
<br>
Click to type...
<br>
</div>
</div>
Another important attribute to add vertical or horizontal margin:
::-webkit-scrollbar-track {
margin: 0 30px;
}
With border-radius, neither box-shadow works properly nor does background-clip: padding-box.
I created a parent div on top of the div which needs scrolling. And fixed the height of parent div and put padding right in the child div. That worked well for my case.
<div class="parent h-10 overflow-scroll">
<div class="scroll child pr-2">
<!-- CONTENT -->
</div>
</div>

Why doesnt the box shadow show above the footer div?

I have a box shadow on the #footermain div in the CSS, but I cant get it to show above the green footer. Ive tried everything and I cant figure it out.
#footermain {
background: #1f6c04;
width: 100%;
-moz-box-shadow: 0 -5px 6px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 -5px 6px rgba(0,0,0,0.5);
box-shadow: 0 -5px 6px rgba(0,0,0,0.5);
}
#footerinner {
height: 150px;
width: 960px;
position: relative;
margin: 0 auto;
}
Here is my CSS for those that dont want to inspect the page
Give
position : relative;
to #footermain.

CSS property overflow:hidden causes inner divs to appear below main div

Is there a way to make my #inner_div stop appearing behind the #main_div if it exceeds a certain width? I tried removing the overflow:hidden from #main_div in css but that causes the background of the #main_div to load very slowly, so I would like to find another solution if possible. Thanks
Main div css:
#main_div {
-moz-border-radius:5px;
-moz-box-shadow: 0 3px 3px rgba(255, 255, 255, 0.1), 0 3px 0 #BBBBBB, 0 4px 0 #AAAAAA, 0 5px 3px #444444;
background: none repeat scroll 0 0 #F6F6F6;
border: 1px solid #FFFFFF;
margin: 20px auto;
overflow: hidden;
padding: 10px;
width: 970px;
}
Inner div css:
.inner_div{
font-size:12px;
font-weight:normal;
font-style:normal;
margin: 5px 0px 0px 10px;
border-style: solid;
border-width: 1px;
border-color: #000000;
z-index: 0;
visibility: hidden;
position: absolute;
/* white-space: nowrap;*/
text-align: left;
padding: 5px 5px 5px 5px;
width:200px;
}
Instead of using overflow:hidden, you should use the new "micro clearfix".
Go here: http://nicolasgallagher.com/micro-clearfix-hack/
In your markup, you simply just add the class "cf" on #main_div

Resources