I have a project: the name (div "h_name") has a fixed position. It's the first div in body, so it should, as I know, stay under all the elements. Unfortunately, somehow it stays above everything. How do I make it go under all other divs? Z-index doesn't work for it too.
Codepen -- https://codepen.io/polina-sotnikova/pen/VwQyXYG
<h1 >dyslexia</h1>
CodePudding user response:
You need a background on the content element or the stacking order will make no difference to what you see on the page. Here is a very simplified example based on the code you provided:
.h_name {
...
background:red;
z-index:-1;
}
.header {
background:blue;
}
And a full snippet here: https://codepen.io/29b6/pen/KKQZoMg
CodePudding user response:
use a id for your class and apply below css.Hope it works...
HTML
<h1 id="h_name">dyslexia</h1>
CSS
#h_name{
z-index:-1!important;
}