CSS shadow such that some div's look they are behind - html

Currently I have a HTML & CSS that results in a page like below
However, I want the shadows above B & C tabs so that it looks like they are behind.
Can anyone hele achieve this?
body {
background-color: rgb(245, 165, 61);
--border-rad: 5px;
}
.wrapper {
width: 80vh;
margin: 5%;
}
.tabs {
display: flex;
justify-content: space-around;
}
.tab {
width: 20%;
color: #000;
background-color: #fff;
margin: 2px 2px 0% 2px;
border-top-left-radius: var(--border-rad);
border-top-right-radius: var(--border-rad);
position: relative;
text-decoration: none;
text-align: center;
}
.tab:before,
.tab:after {
content: "";
position: absolute;
height: 10px;
width: 20px;
bottom: 0;
}
.tab:before {
left: -20px;
border-radius: 0 0 var(--border-rad) 0;
box-shadow: var(--border-rad) 0 0 0 #fff;
}
.tab:after {
right: -20px;
border-radius: 0 0 0 var(--border-rad);
box-shadow: calc(var(--border-rad) * -1) 0 0 0 #fff;
}
.content {
background-color: #fff;
height: 75vh;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.3), 0 -3px 5px rgba(0, 0, 0, 0.3);
border-radius: 10px;
text-align: center;
}
<div class="wrapper">
<div class="tabs">
<span class="tab">A</span>
<span class="tab">B</span>
<span class="tab">C</span>
</div>
<div class="content">content</div>
</div>

You need to temper with the z-index of the different elements. Remember you can only modify the z-index if the element itself has a position set (e.g. position: relative)
Below is a working example. Note that I have also added an "active" class to the currently active tab.
You would need to create JavaScript to make it full functional, but this is the starting point.
Good luck!
body {
background-color: rgb(245, 165, 61);
--border-rad: 5px;
}
.wrapper {
width: 80vh;
margin: 5%;
}
.tabs {
display: flex;
justify-content: space-around;
}
.tab {
position: relative;
width: 20%;
color: #000;
background-color: #fff;
margin: 2px 2px 0% 2px;
border-top-left-radius: var(--border-rad);
border-top-right-radius: var(--border-rad);
position: relative;
text-decoration: none;
text-align: center;
}
.tab.active {
z-index: 2;
}
.tab:before,
.tab:after {
content: "";
position: absolute;
height: 10px;
width: 20px;
bottom: 0;
}
.tab:before {
left: -20px;
border-radius: 0 0 var(--border-rad) 0;
box-shadow: var(--border-rad) 0 0 0 #fff;
}
.tab:after {
right: -20px;
border-radius: 0 0 0 var(--border-rad);
box-shadow: calc(var(--border-rad) * -1) 0 0 0 #fff;
}
.content {
position: relative;
z-index: 1;
background-color: #fff;
height: 75vh;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.3), 0 -3px 5px rgba(0, 0, 0, 0.3);
border-radius: 10px;
text-align: center;
}
<div class="wrapper">
<div class="tabs">
<span class="tab active">A</span>
<span class="tab">B</span>
<span class="tab">C</span>
</div>
<div class="content">content</div>
</div>

Just add these to your content and tab css classes:
.content {
position: relative;
z-index: 2;
}
.tab
z-index: 1;
}
Edit: you need the relative positioning for z-index to work.

You can always try the following css witch will give the box the black shadow and the border bottom you want.
box-shadow: rgb(0 0 0 / 25%) 0px 54px 55px, rgb(0 0 0 / 12%) 0px -12px 30px, rgb(0 0 0 / 12%) 0px 4px 6px, rgb(0 0 0 / 17%) 0px 12px 13px, rgb(0 0 0 / 5%) 0px -3px 5px;
border-bottom: solid;
border-width: thin;
z-index: 50;

Related

Make image fit div and resize accordingly

I'm currently making a forum in school, and I'm working on a profile page. On this profile page, I want to have a couple of banners that the users can choose from. I want to make these banners the same size as the div they're in. I also want them to be centred inside the div and resize it. Is it possible to do what I have shown in the two images where the banner get's cut off when it's resized?
This is my code:
.user-pic {
width: 120px;
border: 3px solid #1b1b1b;
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
float: left;
margin: 10px;
transition: .4s ease-in-out;
z-index: 2;
}
.user-pic:hover {
box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
cursor: pointer;
}
.user-pic-overlay {
width: 120px;
position: absolute;
border: 3px solid #1b1b1b;
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
margin: 10px;
opacity: 0;
transition: .5s ease-in-out;
z-index: 3;
}
.user-pic-overlay:hover {
opacity: .8;
box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
}
.user-header-wrap {
width: 75%;
margin: 25px auto;
box-shadow: 0 5px 35px 0 rgba(0, 0, 0, 0.4);
}
.user-header {
height: 33vh;
margin: auto;
border: 5px solid #1b1b1b;
box-shadow: 0 -25px 100px -22px inset rgba(0, 0, 0, 0.8);
z-index: 2;
}
.user-header-pic {
position: absolute;
z-index: -2;
margin: auto;
width: 75%;
}
.user-header-pic-overlay {
position: absolute;
margin: auto;
height: 33vh;
opacity: 0;
cursor: pointer;
transition: .4s ease-in-out;
}
.user-header-pic-overlay:hover {
opacity: .8;
}
.user-header-nav {
background-color: #1e1e1e;
border: 5px solid #1e1e1e;
text-align: right;
margin: auto;
}
.user-header-btn {
margin: 5px 5px 5px 5px;
padding: .4em .6em;
background-color: #424242;
border-radius: 2px;
font-size: 14px;
color: #f5f5f5;
cursor: pointer;
border: none;
}
.user-haeder-btn:focus {
outline: none;
}
<div class="user-header-wrap">
<div class="user-header">
<img class="user-header-pic" src="../images/header.jpg" alt="">
<img class="user-pic" src="<?php echo $ppp;?>" alt="">
<p class="prof-txt"><?php $ss = $_SESSION["GLOBALNAVN"]; echo $ss; ?></p>
<p class="prof-txt-2">Level</p>
</div>
<div class="user-header-nav">
<button class="user-header-btn">Edit Profile</button>
</div>
</div>
First Image Second Image
added
.user-header-pic {
position: relative;
z-index: -2;
margin: auto;
width: 100%;
height: 100%;
}
.user-pic {
width: 120px;
border: 3px solid #1b1b1b;
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
float: left;
margin: 10px;
transition: .4s ease-in-out;
z-index: 2;
}
.user-pic:hover {
box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
cursor: pointer;
}
.user-pic-overlay {
width: 120px;
position: absolute;
border: 3px solid #1b1b1b;
box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
margin: 10px;
opacity: 0;
transition: .5s ease-in-out;
z-index: 3;
}
.user-pic-overlay:hover {
opacity: .8;
box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
}
.user-header-wrap {
width: 75%;
margin: 25px auto;
box-shadow: 0 5px 35px 0 rgba(0, 0, 0, 0.4);
}
.user-header {
height: 33vh;
margin: auto;
border: 5px solid #1b1b1b;
box-shadow: 0 -25px 100px -22px inset rgba(0, 0, 0, 0.8);
z-index: 2;
}
.user-header-pic {
position: relative;
z-index: -2;
margin: auto;
width: 100%;
height: 100%;
}
.user-header-pic-overlay {
position: absolute;
margin: auto;
height: 33vh;
opacity: 0;
cursor: pointer;
transition: .4s ease-in-out;
}
.user-header-pic-overlay:hover {
opacity: .8;
}
.user-header-nav {
background-color: #1e1e1e;
border: 5px solid #1e1e1e;
text-align: right;
margin: auto;
}
.user-header-btn {
margin: 5px 5px 5px 5px;
padding: .4em .6em;
background-color: #424242;
border-radius: 2px;
font-size: 14px;
color: #f5f5f5;
cursor: pointer;
border: none;
}
.user-haeder-btn:focus {
outline: none;
}
<div class="user-header-wrap">
<div class="user-header">
<img class="user-header-pic" src="https://images.unsplash.com/photo-1553052944-763b0cbd086a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80" alt="">
<img class="user-pic" src="<?php echo $ppp;?>" alt="">
<p class="prof-txt"><?php $ss = $_SESSION["GLOBALNAVN"]; echo $ss; ?></p>
<p class="prof-txt-2">Level</p>
</div>
<div class="user-header-nav">
<button class="user-header-btn">Edit Profile</button>
</div>
</div>

How to remove space between ul and div in css

I have a problem with unwanted gap between ul and div. Maybe you know solution?
#tabs {
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
text-align: center;
font-size: 0;
}
#tabs li {
display: inline-block;
margin: 0 .5em 0 0;
}
#tabs a {
position: relative;
background: #ddd;
background-image: linear-gradient(to bottom, #fff, #ddd);
padding: .7em 3.5em;
float: left;
text-decoration: none;
color: #444;
text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
border-radius: 5px 0 0 0;
box-shadow: 0 2px 2px rgba(0, 0, 0, .4);
font-size: 16px;
}
#content {
background: #fff;
padding: 2em;
height: 220px;
position: relative;
z-index: 2;
border-radius: 0 5px 5px 5px;
box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
width: 1100px;
margin-left: auto;
margin-right: auto;
}
<ul id="tabs">
<li>First</li>
<li>Second</li>
<li>Random</li>
</ul>
<div id="content">
<div id="tab1">...</div>
<div id="tab2">...</div>
<div id="tab3">...</div>
</div>
This problem occurred after inline-block adding. I searched for solutions, but what I have found that was for horizontal gaps (I have fixed it by adding font-size: 0; in parent tab). Maybe there is some solution for vertical gaps?
in #content add float:left; margin-top:0;
Remove the font-size:0
and edit margin to this
#tabs li {
margin: 0 0;
}
you gave it 0.5em which is causing the space between them
Hope it helps
You added padding to the content div which caused this effect
Here's a fiddle where I changed the padding to 0 2em instead
https://jsfiddle.net/6r0x3n0e/
#content {
background: #fff;
padding: 0 2em;
height: 220px;
position: relative;
z-index: 2;
border-radius: 0 5px 5px 5px;
box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
width: 1100px;
margin-left: auto;
margin-right: auto;
}
Hope this helps
Set padding to the following: padding:0em 2em 2em 2em;
#tabs {
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
text-align: center;
font-size: 0;
}
#tabs li {
display: inline-block;
margin: 0 .5em 0 0;
}
#tabs a {
position: relative;
background: #ddd;
background-image: linear-gradient(to bottom, #fff, #ddd);
padding: .7em 3.5em;
float: left;
text-decoration: none;
color: #444;
text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
border-radius: 5px 0 0 0;
box-shadow: 0 2px 2px rgba(0, 0, 0, .4);
font-size: 16px;
}
#content {
background: #fff;
padding: 0em 2em 2em 2em;
height: 220px;
position: relative;
z-index: 2;
border-radius: 0 5px 5px 5px;
box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
width: 1100px;
margin-left: auto;
margin-right: auto;
}
<ul id="tabs">
<li>First</li>
<li>Second</li>
<li>Random</li>
</ul>
<div id="content">
<div id="tab1">...</div>
<div id="tab2">...</div>
<div id="tab3">...</div>
</div>

Get title and buttons for the controls to the middle of this "simon says" game

I'm working on a Simon Says game and I'm having problems putting the title and buttons from the bottom into the middle of the controls section. I've tried different css styles but the divs don't seem to move.
Specially, margin-top to move the elements closer to the middle. Right now they are at the bottom of the page. Here's what I have so far. Any help appreciated. Thanks
body {
background: url("http://cdn.backgroundhost.com/backgrounds/subtlepatterns/purty_wood.png");
font-family: 'Righteous', cursive;
color: black;
}
.container {
margin: 0 auto;
text-align: center;
}
h1 {
font-size: 70px;
}
.simonBoard {
margin: 0 auto;
/* margin-top: 100px; */
border: solid 10px black;
width: 600px;
height: 600px;
border-radius: 600px;
position: relative;
box-shadow: -10px 10px 7px 0px rgba(50, 50, 50, 0.75);
}
.pad {
margin: 0;
float: left;
position: relative;
width: 290px;
height: 290px;
z-index: 8;
border: 5px solid black;
}
.pad-green {
background-color:#0a0;
-moz-border-radius: 300px 0 0 0;
border-radius: 300px 0 0 0;
}
.pad-red {
background-color: red;
-moz-border-radius: 0 300px 0 0;
border-radius: 0 300px 0 0;
}
.pad-yellow {
background-color: yellow;
-moz-border-radius: 0 0 0 300px;
border-radius: 0 0 0 300px;
}
.pad-blue {
background-color: blue;
-moz-border-radius: 0 0 300px 0;
border-radius: 0 0 300px 0;
}
.board-controls {
display: inline-block;
border: 15px solid black;
height: 245px;
width: 245px;
border-radius: 150px;
background-color: white;
position: absolute;
z-index: 10;
top: 0; left: 0; right: 0; bottom: 0;
margin: auto;
-webkit-box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75);
/* -moz-box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75); */
}
<div class="container">
<div class="header">
<h1>SIMON</h1>
</div>
<div class="simonBoard">
<div class="pad pad-green"></div>
<div class="pad pad-red"></div>
<div class="pad pad-yellow"></div>
<div class="pad pad-blue"></div>
<div class="board-controls">
<div class="title">SIMON</div>
<div class="display">07</div>
<div class="start">START</div>
<div class="strict">STRICT</div>
<div class="switch">ON/OFF</div>
</div>
</div>
</div>
body {
background: url("http://cdn.backgroundhost.com/backgrounds/subtlepatterns/purty_wood.png");
font-family: 'Righteous', cursive;
color: black;
}
.container {
margin: 0 auto;
text-align: center;
}
h1 {
font-size: 70px;
}
.simonBoard {
margin: 0 auto;
/* margin-top: 100px; */
border: solid 10px black;
width: 600px;
height: 600px;
border-radius: 600px;
position: relative;
box-shadow: -10px 10px 7px 0px rgba(50, 50, 50, 0.75);
}
.pad {
margin: 0;
float: left;
position: relative;
width: 290px;
height: 290px;
z-index: 8;
border: 5px solid black;
}
.pad-green {
background-color:#0a0;
-moz-border-radius: 300px 0 0 0;
border-radius: 300px 0 0 0;
}
.pad-red {
background-color: red;
-moz-border-radius: 0 300px 0 0;
border-radius: 0 300px 0 0;
}
.pad-yellow {
background-color: yellow;
-moz-border-radius: 0 0 0 300px;
border-radius: 0 0 0 300px;
}
.pad-blue {
background-color: blue;
-moz-border-radius: 0 0 300px 0;
border-radius: 0 0 300px 0;
}
.board-controls {
display: inline-block;
border: 15px solid black;
height: 245px;
width: 245px;
border-radius: 150px;
background-color: white;
position: absolute;
z-index: 10;
top: 0; left: 0; right: 0; bottom: 0;
margin: auto;
-webkit-box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75);
/* -moz-box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75); */
}
<div class="container">
<div class="header">
<h1>SIMON</h1>
</div>
<div class="simonBoard">
<div class="pad pad-green"></div>
<div class="pad pad-red"></div>
<div class="pad pad-yellow"></div>
<div class="pad pad-blue"></div>
<div class="board-controls">
<div class="title">SIMON</div>
<div class="display">07</div>
<div class="start">START</div>
<div class="strict">STRICT</div>
<div class="switch">ON/OFF</div>
</div>
</div>
</div>
I did set .board-controls's position:absolute.
And set .simonBoard's position:relative.
I think it is not good answer.
I would approach it by adding another div inside your board-controls div.
As follows -
<div class="board-controls">
<div class="control-menu">
<div class="title">SIMON</div>
<div class="display">07</div>
<div class="start">START</div>
<div class="strict">STRICT</div>
<div class="switch">ON/OFF</div>
</div>
</div>
and then add the following css -
.control-menu {
position:absolute;
text-align:center;
top:0;
bottom:0;
left:0;
right:0;
margin:auto;
height:50%;
}
This will make the new control-menu div a section in its own right and then the absolute positioning will try and pull it in each direction, therefore making it sit centrally inside the board-controls.
You can adjust the height that the menu sits using the height percentage in the supplied css.
Here is a JSFiddle displaying it working.
https://jsfiddle.net/jvshu3du/1/
As each div are nested you could either individually declare and style that or you have to change positioning of .simonBoard to relative and inside .board-controls to absolute then using top, left and translate you can align .simonBoard to center of page and same .board-controls.
body {
background: url("http://cdn.backgroundhost.com/backgrounds/subtlepatterns/purty_wood.png");
font-family: 'Righteous', cursive;
color: black;
}
.container {
margin: 0 auto;
text-align: center;
}
h1 {
font-size: 70px;
}
.simonBoard {
border: solid 10px black;
width: 600px;
height: 600px;
border-radius: 600px;
box-shadow: -10px 10px 7px 0px rgba(50, 50, 50, 0.75);
position: relative;
left: 50%;
top: 50%;
transform: translate(-50%, 0);
}
.pad {
margin: 0;
float: left;
position: relative;
width: 290px;
height: 290px;
z-index: 8;
border: 5px solid black;
}
.pad-green {
background-color: #0a0;
-moz-border-radius: 300px 0 0 0;
border-radius: 300px 0 0 0;
}
.pad-red {
background-color: red;
-moz-border-radius: 0 300px 0 0;
border-radius: 0 300px 0 0;
}
.pad-yellow {
background-color: yellow;
-moz-border-radius: 0 0 0 300px;
border-radius: 0 0 0 300px;
}
.pad-blue {
background-color: blue;
-moz-border-radius: 0 0 300px 0;
border-radius: 0 0 300px 0;
}
.board-controls {
border: 15px solid black;
height: 245px;
width: 245px;
border-radius: 150px;
background-color: white;
z-index: 10;
-webkit-box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75);
/* -moz-box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75); */
position: absolute;
transform: translate(50%, 50%);
}
.title {
padding-top: 60px;
}
<div class="container">
<div class="header">
<h1>SIMON</h1>
</div>
<div class="simonBoard">
<div class="pad pad-green"></div>
<div class="pad pad-red"></div>
<div class="pad pad-yellow"></div>
<div class="pad pad-blue"></div>
<div class="board-controls">
<div class="title">SIMON</div>
<div class="display">07</div>
<div class="start">START</div>
<div class="strict">STRICT</div>
<div class="switch">ON/OFF</div>
</div>
</div>
</div>
First of all, the main issue is you are not clearing the floats that you are applying to the four pad divs. That is why when using floating containers, it is always said that we should properly clear the floats. The rest is easy.
Clear float by giving clear: both to the board-controls.
Now add position: relative to simonBoard and center the board-controls using this:
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
(the queer thing is that clearing floats doesn't matter now though as you are using absolute position, but you should be doing it)
Now center the divs inside the board-controls by using line-height if you'd like that:
.board-controls > * {
line-height: 45px;
}
See demo below:
body {
background: url("http://cdn.backgroundhost.com/backgrounds/subtlepatterns/purty_wood.png");
font-family: 'Righteous', cursive;
color: black;
}
.container {
margin: 0 auto;
text-align: center;
}
h1 {
font-size: 70px;
}
.simonBoard {
margin: 0 auto;
border: solid 10px black;
width: 600px;
height: 600px;
border-radius: 600px;
box-shadow: -10px 10px 7px 0px rgba(50, 50, 50, 0.75);
position: relative;
}
.pad {
margin: 0;
float: left;
position: relative;
width: 290px;
height: 290px;
z-index: 8;
border: 5px solid black;
}
.pad-green {
background-color: #0a0;
-moz-border-radius: 300px 0 0 0;
border-radius: 300px 0 0 0;
}
.pad-red {
background-color: red;
-moz-border-radius: 0 300px 0 0;
border-radius: 0 300px 0 0;
}
.pad-yellow {
background-color: yellow;
-moz-border-radius: 0 0 0 300px;
border-radius: 0 0 0 300px;
}
.pad-blue {
background-color: blue;
-moz-border-radius: 0 0 300px 0;
border-radius: 0 0 300px 0;
}
.board-controls {
border: 15px solid black;
height: 245px;
width: 245px;
border-radius: 150px;
background-color: white;
z-index: 10;
clear: both;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-box-shadow: -6px 8px 5px 0px rgba(50, 50, 50, 0.75);
}
.board-controls > * {
line-height: 45px;
}
<div class="container">
<div class="header">
<h1>SIMON</h1>
</div>
<div class="simonBoard">
<div class="pad pad-green"></div>
<div class="pad pad-red"></div>
<div class="pad pad-yellow"></div>
<div class="pad pad-blue"></div>
<div class="board-controls">
<div class="title">SIMON</div>
<div class="display">07</div>
<div class="start">START</div>
<div class="strict">STRICT</div>
<div class="switch">ON/OFF</div>
</div>
</div>
</div>

Why z-index doesnt work?

I have simple html and css code :
HTML:
<div class="header">
<div class="tip"></div>
</div>
CSS:
.header {
display: block;
width: 260px;
min-height: 222px;
background-color: #252525;
position: relative;
z-index: 5;
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
border-radius: 2px;
}
.tip {
display: inline-block;
width: 10px;
height: 10px;
right: 11px;
top: -5px;
transform: rotateZ(45deg);
position: absolute;
z-index: 1;
background-color: red;
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
}
I just want to .tip block was under .header block.
But now it looks like this, although the z-index of .tip is less then z-index of .header:
This is what I want:
For some reason, z-index doesn't work.
It's necessary for me to set z-index on .header block, because I have another blocks on page which have z-index too
To make the child of a parent element have a higher z-index than the parent element, remove the parent's z-index value.
.header {
display: block;
width: 260px;
min-height: 222px;
background-color: #252525;
position: relative;
/*z-index: 5;*/
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
border-radius: 2px;
}
.tip {
display: inline-block;
width: 10px;
height: 10px;
right: 11px;
top: -5px;
transform: rotateZ(45deg);
position: absolute;
z-index: -1;
background-color: red;
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
}
<div class="header">
<div class="tip"></div>
</div>
try changing 1 to -1...and remove z-index: 5 in the first block (header); take a look of this part of the code:
.header {
display: block;
width: 260px;
min-height: 222px;
background-color: #252525;
position: relative;
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
border-radius: 2px;
}
.tip {
display: inline-block;
width: 10px;
height: 10px;
right: 11px;
top: -5px;
transform: rotateZ(45deg);
position: absolute;
z-index: -1;
background-color: red;
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
}

Tabs with dropshadow only around active

Is there a way to realize the following kind of shadow with CSS only?
So far I only managed to draw the shadow around the complete box without the recess around the inactive tab:
The Code Here
HTML:
<div class="box">
<div class="tabs">
<span class="tab active">Bild</span>
<span class="tab">Text</span>
</div>
<div class="content"></div>
</div>
CSS:
.box {
width: 200px;
height: 250px;
box-shadow: 0 0 2.5px 2px rgba(0, 0, 0, 0.18);
margin: 16px;
}
.tabs {
height: 30px;
}
.tab {
display: inline-block;
width: calc(50% - 2px);
height: 30px;
text-align: center;
line-height: 30px;
}
.tab:not(.active) {
/* Should be removed in the final solution with correct shadows... */
background-color: rgba(0, 0, 0, 0.18);
}
The solution doesn't need to take care of legacy browsers (< IE 10).
Thanks
Use This CSS
.tab.active {
box-shadow: 0 -5px 2.5px 2px rgba(0, 0, 0, 0.18);
position: relative;
z-index: 99999;
}
.tab {
background: #fff none repeat scroll 0 0;
display: inline-block;
height: 30px;
line-height: 30px;
text-align: center;
width: calc(50% - 2px);
}
.content {
box-shadow: 0 0 2.5px 2px rgba(0, 0, 0, 0.18);
margin-top: 0;
min-height: 50px;
position: relative;
z-index: 999;
}
Edit Your CSS
.box {
- Remove this-
/*box-shadow: 0 0 2.5px 2px rgba(0, 0, 0, 0.18); */
height: 250px;
margin: 16px;
width: 200px;
}