I have problem with z-index value in child element.
Structure looks like this:
#header {
position: relative;
z-index: 2;
width: 100%;
height: 15vh;
display: block;
margin: 0 auto;
background-color: white;
color: #44a9ff;
padding: 0;
overflow: hidden;
border-bottom: 3px solid #44a9ff;
-webkit-box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
}
#main {
position: relative;
z-index: 1;
width: 100%;
height: 75vh;
display: block;
margin: 0 auto;
overflow: hidden;
padding: 0;
background: url('img/main_bg.jpg') no-repeat center center;
background-size: cover;
border-bottom: 3px solid #44a9ff;
}
#box {
position: relative;
z-index: 10;
width: 40%;
height: 38vh;
background-color: #44a9ff;
float: right;
color: white;
display: block;
overflow: hidden;
}
<div id="nav">
<ul>
<li>..</li>
<li>..</li>
</ul>
</div>
<div id="main">
<div id="box">
</div>
</div>
Element #nav has z-index 2, because there is box shadow in the bottom. #main has z-index 1, because when is higher, shadow is not visible. And than there is #box, which has z index 3, because I need it to cover shadow from #nav. But it probably has value of z-index from #main, so it doesn't cover it. How could I fix this please?
Try taking #box out of #main and setting it absolute above with right & top coordinates:
#header {
position: relative;
z-index: 2;
width: 100%;
height: 15vh;
display: block;
margin: 0 auto;
background-color: white;
color: #44a9ff;
padding: 0;
overflow: hidden;
border-bottom: 3px solid #44a9ff;
-webkit-box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
box-shadow: 8px 1px 41px 0px rgba(0, 0, 0, 0.75);
}
#main {
position: relative;
z-index: 1;
width: 100%;
height: 75vh;
display: block;
margin: 0 auto;
overflow: hidden;
padding: 0;
background: url('img/main_bg.jpg') no-repeat center center;
background-size: cover;
border-bottom: 3px solid #44a9ff;
background: green;
}
#box {
/* set it absolute */
position: absolute;
/* tweak coordinates to your benefit */
right: 8px;
top: 19vh;
z-index: 3;
width: 40%;
height: 38vh;
background-color: #44a9ff;
color: white;
display: block;
overflow: hidden;
}
<div id="header">
<div id="nav">
<ul>
<li>..
</li>
<li>..
</li>
</ul>
</div>
</div>
<div id="main"></div>
<div id="box"></div>
try moving #box out of #main and give it a custom css code to get it to the right position
<div id="nav">
<ul>
<li>..</li>
<li>..</li>
</ul>
</div>
<div id="box">
</div>
<div id="main">
</div>
Related
I am trying to make a progress bar as is shown here in the about section however I am just lost.
I can make a bar and a box but neither look anywhere near as good as that and I cannot for the life of me get them to be beside each other with equal height. I just keep getting something along the lines of
What I am trying to achieve in case website goes down:
.myskills {
width: 45vw;
height: 100%;
background: red;
margin: 1em;
}
.skillbarContainer {
display: flex;
justify-content: center;
height: 2vh;
}
.skillName {
background-color: blue;
width: 5vw;
float: left;
height: 100%;
font-size: 2em;
}
.meter {
float: left;
width: 80%;
height: 100%;
/* Can be anything */
position: relative;
background: #555;
padding: 3px;
}
.meter>span {
display: block;
height: 100%;
background-color: hotpink;
box-shadow: inset 0 2px 9px rgba(255, 255, 255, 0.3), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
position: relative;
overflow: hidden;
}
<div class="myskills">
<div class="skillbarContainer">
<div class="skillName">HTML</div>
<div class="meter">
<span style="width: 80%"></span>
</div>
</div>
</div>
This code below will give you the percentage sign on the right of the percentage bar. A lot of this is purely layering with hmtl/css.
Here are some links for layering and z-index:
https://www.tutorialspoint.com/css/css_layers.htm#:~:text=The%20CSS%20layers%20refer%20to,element%20should%20come%20at%20bottom.
https://www.w3schools.com/cssref/pr_pos_z-index.asp
https://css-tricks.com/almanac/properties/z/z-index/
.myskills {
width: 90%%;
background: red;
margin: 1em;
}
.skillbarContainer {
display: flex;
}
.skillLevel{
right: 0;
font-size: 1.7em;
position: absolute;
}
.skillName {
background-color: rgb(77, 252, 208);
float: left;
font-size: 2em;
}
.meter {
float: left;
width: 100%;
/* Can be anything */
position: relative;
background: rgb(218, 217, 217);
padding: 3px;
}
.meter>span {
display: block;
height: 100%;
background-color: rgb(31, 134, 117);
box-shadow: inset 0 2px 9px rgba(255, 255, 255, 0.3), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
}
<div class="myskills">
<div class="skillbarContainer">
<div class="skillName">HTML</div>
<div class="meter">
<span style="width: 80%"><span class="skillLevel">90%</span></span>
</div>
</div>
</div>
Well, IMO you should use less vh and vw. Your font simply defines the height and the width of the text part. By removing them, you get something as you want as I understood (I also removed useless properties) :
.myskills {
width: 45vw;
background: red;
margin: 1em;
}
.skillbarContainer {
display: flex;
}
.skillName {
background-color: blue;
font-size: 2em;
}
.meter {
float: left;
width: 100%;
/* Can be anything */
position: relative;
background: #555;
padding: 3px;
}
.meter>span {
display: block;
height: 100%;
background-color: hotpink;
box-shadow: inset 0 2px 9px rgba(255, 255, 255, 0.3), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
}
<div class="myskills">
<div class="skillbarContainer">
<div class="skillName">HTML</div>
<div class="meter">
<span style="width: 80%"></span>
</div>
</div>
</div>
Now, if it was my progress bar I'd use flex instead of width for .meter, I'd take a smaller font size and put padding to the text :
.myskills {
width: 45vw;
background: red;
margin: 1em;
}
.skillbarContainer {
display: flex;
}
.skillName {
background-color: blue;
font-size: 18px;
padding: 3px 10px;
}
.meter {
float: left;
flex: 1;
/* Can be anything */
position: relative;
background: #555;
padding: 3px;
}
.meter>span {
display: block;
height: 100%;
background-color: hotpink;
box-shadow: inset 0 2px 9px rgba(255, 255, 255, 0.3), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
}
<div class="myskills">
<div class="skillbarContainer">
<div class="skillName">HTML</div>
<div class="meter">
<span style="width: 80%"></span>
</div>
</div>
</div>
I am trying to create a Card in HTML/CSS, that looks like:
BUT, what I want exactly is that the background, instead of being just grey like it is, is an image instead.
Here is what I've tried: JsFiddle
HTML:
<div class="card">
<img src="https://www.washingtonpost.com/resizer/9YWv-qOa9uW7CQZ9UGiW23eTZzU=/1484x0/arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/BTCNJJN2Y43KPHPXPQWPASXRKM.jpg" alt="Avatar" class='image'>
<div class="container">
<h3>John Doe</h3>
<p>Architect & Engineer</p>
</div>
</div>
CSS:
.card {
border: 1px solid #dadada;
box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.2s;
width: 50%;
}
.card h3 {
padding: 2px;
margin: 8px 0;
}
.image {
width:100%;
clip-path: polygon(0 0, 100% 0, 100% 42%, 0 23%);
}
As you can see it works, but the problem is that there's space in between the image and the 'John Doe'.
I would like to know how to remove the space between the image and the John Doe.
Thanks
Here is a simple solution with css transform.
.wrapper {
position: relative;
width: 280px;
height: 350px;
background: url('https://upload.wikimedia.org/wikipedia/commons/e/e1/FullMoon2010.jpg') 0 0 no-repeat;
background-size: cover;
overflow: hidden;
}
.box {
position: absolute;
bottom: 0;
width: 100%;
height: 50%;
background: #cdcdcd;
}
.content {
position: absolute;
z-index: 10;
padding: 15px;
box-sizing: border-box;
}
.folder {
position: absolute;
top: -20px;
left: -10px;
width: 120%;
height: 60px;
background: #cdcdcd;
transform: rotate(8deg);
}
<div class="wrapper">
<div class="box">
<div class="content">Here is my content.</div>
<div class="folder"></div>
</div>
</div>
You can add the following to your css:
.container {
position: absolute;
top: 150px;
}
You will see that your card's height is influenced. You can the just give your card a height that you desire, like this:
.card {
height: 300px //this is your prefered height
}
.card {
border: 1px solid #dadada;
box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.2s;
width: 50%;
height:200px;
position:relative;
}
.card h3 {
padding: 2px;
margin: 8px 0;
/* line-height: 20px !important;
font-size: 18px !important;
font-weight: 500 !important; */
}
.card:hover {
box-shadow: 8px 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.card .container {
padding: 2px 14px;
position: absolute;
top: 45%;
}
.card p {
margin: 14px 0;
}
.card img {
position:absolute
}
//that's all..
Rely on background and you will have better support and less code:
.card {
border: 1px solid #dadada;
box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.2s;
padding:100px 10px 5px;
width: 50%;
background:
linear-gradient(to bottom left,transparent 49.5%,#fff 50%) 0 50px/100% 100px,
linear-gradient(#fff,#fff) bottom/100% calc(100% - 150px),
url(https://www.washingtonpost.com/resizer/9YWv-qOa9uW7CQZ9UGiW23eTZzU=/1484x0/arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/BTCNJJN2Y43KPHPXPQWPASXRKM.jpg) top/100% auto no-repeat;
background-repeat:no-repeat;
}
.card h3 {
padding: 2px;
margin: 8px 0;
}
<div class="card">
<h3>John Doe</h3>
<p>Architect & Engineer</p>
</div>
I have a header a main and a footer. The the header and the foter have fixed heights. The main has a min-height of 100% - 250px(header + footer). I want to extend the div id="content" inside the main to the full height of the main. Why isn't it working?
html {
height: 100%;
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
background-color: #f5f5f5;
margin: 0;
padding: 0;
position: relative;
height: 100%;
}
header {
background-color: #131b23;
border-bottom: 6px solid #0f151a;
text-align: center;
left: 0;
top: 0;
width: 100%;
height: 170px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
z-index: 99;
}
main {
text-align: center;
min-height: calc(100% - 250px);
/* Header 170px + Footer 80px = 250px */
background-color: blue;
}
#content {
width: 65%;
margin-left: auto;
margin-right: auto;
background-color: red;
min-height: 100%;
}
footer {
background-color: #131b23;
border-top: 6px solid #0f151a;
text-align: center;
height: 80px;
z-index: 98;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
width: 100%;
}
<header>
</header>
<main>
<div id="content">
Text 123
</div>
</main>
<footer>
</footer>
min-height will work if parent has defined height as height in percentage is relative to parent.
In your case, parent of content div is main and main has min-height : calc(100% - 250px) and not height. Change min-height to height for main.
This works as long as the page is taller than the content. You might need to display the result in full page view.
html {
height: 100%;
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
background-color: #f5f5f5;
margin: 0;
padding: 0;
position: relative;
height: 100%;
}
header {
background-color: #131b23;
border-bottom: 6px solid #0f151a;
text-align: center;
left: 0;
top: 0;
width: 100%;
height: 170px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
z-index: 99;
}
main {
text-align: center;
min-height: calc(100% - 250px);
/* Header 170px + Footer 80px = 250px */
background-color: blue;
position:relative;
}
#content {
width: 65%;
margin-left: 17.5%;
margin-right: 17.5%;
background-color: red;
height: 100%;
position:absolute
}
footer {
background-color: #131b23;
border-top: 6px solid #0f151a;
text-align: center;
height: 80px;
z-index: 98;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
width: 100%;
}
<header>
</header>
<main>
<div id="content">
Text 123
</div>
</main>
<footer>
</footer>
</body>
</html>
use this css to set height of content to 100%
#content {
width: 65%;
margin-left: auto;
min-height:100%;
margin-right: auto;
background-color: red;
}
snippet
html,body {
height: 100%;
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
background-color: #f5f5f5;
margin: 0;
padding: 0;
position: relative;
height: 100%;
}
main {
text-align: center;
min-height: calc(100% - 250px);
/* Header 170px + Footer 80px = 250px */
background-color: blue;
}
header {
background-color: #131b23;
border-bottom: 6px solid #0f151a;
text-align: center;
left: 0;
top: 0;
width: 100%;
height: 170px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
z-index: 99;
}
#content {
width: 65%;
margin-left: auto;
min-height:100%;
margin-right: auto;
background-color: red;
}
footer {
background-color: #131b23;
border-top: 6px solid #0f151a;
text-align: center;
height: 80px;
z-index: 98;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
width: 100%;
}
<header>
</header>
<main id=mai >
<div id="content" style="height:100px">
Text 123Text 123Text 123Text 123Text 123
</div>
</main>
<footer>
</footer>
<style>
</style>
Why is the height 100% not working?
because height of main content is set to 100% which means set height of content in which to fit all info in content .
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>
<nav class="offcanvas-menu">
<div class="user-details"></div>
<ul class="test">
<li>content</li>
</ul>
<div class=navfooter>
footer content
</div>
</nav>
i dont know how to get the .navfooter on the bottom of the sidebar. it is allways unter the .test container. i tryed couple of things but its not getting work
these are the styles for it
<style>
.test{
left: 0;
top: 20%;
height: 400px;
width: 200px;
background: #ECF0F1;
-webkit-box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.40);
box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.40);
}
.navfooter {
position: relative;
bottom: 0;
z-index: 999;
height: 64px;
width: 100%;
background: #1e67cb;
box-shadow: 0 -1px 5px rgba(0,0,0,.6);
-webkit-box-shadow: 0 -1px 5px rgba(0,0,0,.6);
}
.offcanvas-menu {
position: fixed;
top: 0;
left: 0;
z-index: 1031;
/*visibility: hidden;*/
background: #fff;
border-right: 1px solid #CCC;
width: 250px;
height: 100%;
-webkit-transition: all 0.5s;
transition: all 0.5s;
}
</style>
Have you tried changing the .navfooter to absolute?
.navfooter {
position: absolute;
bottom: 0;
z-index: 999;
height: 64px;
width: 100%;
background: #1e67cb;
box-shadow: 0 -1px 5px rgba(0,0,0,.6);
-webkit-box-shadow: 0 -1px 5px rgba(0,0,0,.6);
}