Z-index on a absolute container in a fixed containter












0















enter image description here



enter image description here



header{
position:fixed;
top:0;
left:0;
background-color: $color;
width: $width;
height: 56px;
}

.utility{
@include lockPosition(10px);
right:10px;
width:700px;
height:20px;
padding-top:10px;
z-index:1000;
position:absolute;
}


I find that only absolute position fixes the z-index issue I am having but I want the header to be fixed so it does scroll. Is there a way to have a absolute position in a fixed element and not effect the z-index?










share|improve this question

























  • What's @include lockPosition, is that a mixin?

    – Amy Lee
    Nov 23 '18 at 3:09











  • yea, I just noticed I have position set to absolute twice, but that doesn't matter: `@mixin lockPosition($topMargin:100%){ position:absolute; top:$topMargin; }'

    – Joseph Marini
    Nov 23 '18 at 3:12











  • Just wondering why do you use float right on the .utility?

    – Amy Lee
    Nov 23 '18 at 3:15











  • Maybe it be easier if i'll be able to see how you want the layout to look like

    – Amy Lee
    Nov 23 '18 at 3:18











  • added a screenshot of the issue I am having. It is showing on scroll.

    – Joseph Marini
    Nov 23 '18 at 3:20


















0















enter image description here



enter image description here



header{
position:fixed;
top:0;
left:0;
background-color: $color;
width: $width;
height: 56px;
}

.utility{
@include lockPosition(10px);
right:10px;
width:700px;
height:20px;
padding-top:10px;
z-index:1000;
position:absolute;
}


I find that only absolute position fixes the z-index issue I am having but I want the header to be fixed so it does scroll. Is there a way to have a absolute position in a fixed element and not effect the z-index?










share|improve this question

























  • What's @include lockPosition, is that a mixin?

    – Amy Lee
    Nov 23 '18 at 3:09











  • yea, I just noticed I have position set to absolute twice, but that doesn't matter: `@mixin lockPosition($topMargin:100%){ position:absolute; top:$topMargin; }'

    – Joseph Marini
    Nov 23 '18 at 3:12











  • Just wondering why do you use float right on the .utility?

    – Amy Lee
    Nov 23 '18 at 3:15











  • Maybe it be easier if i'll be able to see how you want the layout to look like

    – Amy Lee
    Nov 23 '18 at 3:18











  • added a screenshot of the issue I am having. It is showing on scroll.

    – Joseph Marini
    Nov 23 '18 at 3:20
















0












0








0








enter image description here



enter image description here



header{
position:fixed;
top:0;
left:0;
background-color: $color;
width: $width;
height: 56px;
}

.utility{
@include lockPosition(10px);
right:10px;
width:700px;
height:20px;
padding-top:10px;
z-index:1000;
position:absolute;
}


I find that only absolute position fixes the z-index issue I am having but I want the header to be fixed so it does scroll. Is there a way to have a absolute position in a fixed element and not effect the z-index?










share|improve this question
















enter image description here



enter image description here



header{
position:fixed;
top:0;
left:0;
background-color: $color;
width: $width;
height: 56px;
}

.utility{
@include lockPosition(10px);
right:10px;
width:700px;
height:20px;
padding-top:10px;
z-index:1000;
position:absolute;
}


I find that only absolute position fixes the z-index issue I am having but I want the header to be fixed so it does scroll. Is there a way to have a absolute position in a fixed element and not effect the z-index?







z-index






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 3:37







Joseph Marini

















asked Nov 23 '18 at 3:02









Joseph MariniJoseph Marini

14




14













  • What's @include lockPosition, is that a mixin?

    – Amy Lee
    Nov 23 '18 at 3:09











  • yea, I just noticed I have position set to absolute twice, but that doesn't matter: `@mixin lockPosition($topMargin:100%){ position:absolute; top:$topMargin; }'

    – Joseph Marini
    Nov 23 '18 at 3:12











  • Just wondering why do you use float right on the .utility?

    – Amy Lee
    Nov 23 '18 at 3:15











  • Maybe it be easier if i'll be able to see how you want the layout to look like

    – Amy Lee
    Nov 23 '18 at 3:18











  • added a screenshot of the issue I am having. It is showing on scroll.

    – Joseph Marini
    Nov 23 '18 at 3:20





















  • What's @include lockPosition, is that a mixin?

    – Amy Lee
    Nov 23 '18 at 3:09











  • yea, I just noticed I have position set to absolute twice, but that doesn't matter: `@mixin lockPosition($topMargin:100%){ position:absolute; top:$topMargin; }'

    – Joseph Marini
    Nov 23 '18 at 3:12











  • Just wondering why do you use float right on the .utility?

    – Amy Lee
    Nov 23 '18 at 3:15











  • Maybe it be easier if i'll be able to see how you want the layout to look like

    – Amy Lee
    Nov 23 '18 at 3:18











  • added a screenshot of the issue I am having. It is showing on scroll.

    – Joseph Marini
    Nov 23 '18 at 3:20



















What's @include lockPosition, is that a mixin?

– Amy Lee
Nov 23 '18 at 3:09





What's @include lockPosition, is that a mixin?

– Amy Lee
Nov 23 '18 at 3:09













yea, I just noticed I have position set to absolute twice, but that doesn't matter: `@mixin lockPosition($topMargin:100%){ position:absolute; top:$topMargin; }'

– Joseph Marini
Nov 23 '18 at 3:12





yea, I just noticed I have position set to absolute twice, but that doesn't matter: `@mixin lockPosition($topMargin:100%){ position:absolute; top:$topMargin; }'

– Joseph Marini
Nov 23 '18 at 3:12













Just wondering why do you use float right on the .utility?

– Amy Lee
Nov 23 '18 at 3:15





Just wondering why do you use float right on the .utility?

– Amy Lee
Nov 23 '18 at 3:15













Maybe it be easier if i'll be able to see how you want the layout to look like

– Amy Lee
Nov 23 '18 at 3:18





Maybe it be easier if i'll be able to see how you want the layout to look like

– Amy Lee
Nov 23 '18 at 3:18













added a screenshot of the issue I am having. It is showing on scroll.

– Joseph Marini
Nov 23 '18 at 3:20







added a screenshot of the issue I am having. It is showing on scroll.

– Joseph Marini
Nov 23 '18 at 3:20














1 Answer
1






active

oldest

votes


















0














I think the easiest way is to push down the box with absolute position, i guess on .utility,



.utility{top: npx}


As for your question, the importances of the z-index is depending on how you lays the HTML DOM, so for example if your



<header>Your fixed position</header>
<main>
<nav>Your absolute position</nav>
</main>


with your fixed position z-index will be much more important than your



Hope that helps,






share|improve this answer
























  • it doesn't seem to be working. I have changed the header to fixed and .utility(child element) to absolute.

    – Joseph Marini
    Nov 23 '18 at 3:35













  • Did you add top: xx px on the absolute? or margin-top: xx px on the absolute element?

    – Amy Lee
    Nov 23 '18 at 3:37











  • So .utility is inside the <header> ?

    – Amy Lee
    Nov 23 '18 at 3:38











  • If it is i think you should place it outside the header, cause position fixed isn't the same as relative

    – Amy Lee
    Nov 23 '18 at 3:39











  • .utility{ position:absolute; right:10px; width:700px; height:20px; padding-top:10px; z-index:1000; top: 0px; } doesn't work

    – Joseph Marini
    Nov 23 '18 at 3:43













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440172%2fz-index-on-a-absolute-container-in-a-fixed-containter%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I think the easiest way is to push down the box with absolute position, i guess on .utility,



.utility{top: npx}


As for your question, the importances of the z-index is depending on how you lays the HTML DOM, so for example if your



<header>Your fixed position</header>
<main>
<nav>Your absolute position</nav>
</main>


with your fixed position z-index will be much more important than your



Hope that helps,






share|improve this answer
























  • it doesn't seem to be working. I have changed the header to fixed and .utility(child element) to absolute.

    – Joseph Marini
    Nov 23 '18 at 3:35













  • Did you add top: xx px on the absolute? or margin-top: xx px on the absolute element?

    – Amy Lee
    Nov 23 '18 at 3:37











  • So .utility is inside the <header> ?

    – Amy Lee
    Nov 23 '18 at 3:38











  • If it is i think you should place it outside the header, cause position fixed isn't the same as relative

    – Amy Lee
    Nov 23 '18 at 3:39











  • .utility{ position:absolute; right:10px; width:700px; height:20px; padding-top:10px; z-index:1000; top: 0px; } doesn't work

    – Joseph Marini
    Nov 23 '18 at 3:43


















0














I think the easiest way is to push down the box with absolute position, i guess on .utility,



.utility{top: npx}


As for your question, the importances of the z-index is depending on how you lays the HTML DOM, so for example if your



<header>Your fixed position</header>
<main>
<nav>Your absolute position</nav>
</main>


with your fixed position z-index will be much more important than your



Hope that helps,






share|improve this answer
























  • it doesn't seem to be working. I have changed the header to fixed and .utility(child element) to absolute.

    – Joseph Marini
    Nov 23 '18 at 3:35













  • Did you add top: xx px on the absolute? or margin-top: xx px on the absolute element?

    – Amy Lee
    Nov 23 '18 at 3:37











  • So .utility is inside the <header> ?

    – Amy Lee
    Nov 23 '18 at 3:38











  • If it is i think you should place it outside the header, cause position fixed isn't the same as relative

    – Amy Lee
    Nov 23 '18 at 3:39











  • .utility{ position:absolute; right:10px; width:700px; height:20px; padding-top:10px; z-index:1000; top: 0px; } doesn't work

    – Joseph Marini
    Nov 23 '18 at 3:43
















0












0








0







I think the easiest way is to push down the box with absolute position, i guess on .utility,



.utility{top: npx}


As for your question, the importances of the z-index is depending on how you lays the HTML DOM, so for example if your



<header>Your fixed position</header>
<main>
<nav>Your absolute position</nav>
</main>


with your fixed position z-index will be much more important than your



Hope that helps,






share|improve this answer













I think the easiest way is to push down the box with absolute position, i guess on .utility,



.utility{top: npx}


As for your question, the importances of the z-index is depending on how you lays the HTML DOM, so for example if your



<header>Your fixed position</header>
<main>
<nav>Your absolute position</nav>
</main>


with your fixed position z-index will be much more important than your



Hope that helps,







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 '18 at 3:27









Amy LeeAmy Lee

149111




149111













  • it doesn't seem to be working. I have changed the header to fixed and .utility(child element) to absolute.

    – Joseph Marini
    Nov 23 '18 at 3:35













  • Did you add top: xx px on the absolute? or margin-top: xx px on the absolute element?

    – Amy Lee
    Nov 23 '18 at 3:37











  • So .utility is inside the <header> ?

    – Amy Lee
    Nov 23 '18 at 3:38











  • If it is i think you should place it outside the header, cause position fixed isn't the same as relative

    – Amy Lee
    Nov 23 '18 at 3:39











  • .utility{ position:absolute; right:10px; width:700px; height:20px; padding-top:10px; z-index:1000; top: 0px; } doesn't work

    – Joseph Marini
    Nov 23 '18 at 3:43





















  • it doesn't seem to be working. I have changed the header to fixed and .utility(child element) to absolute.

    – Joseph Marini
    Nov 23 '18 at 3:35













  • Did you add top: xx px on the absolute? or margin-top: xx px on the absolute element?

    – Amy Lee
    Nov 23 '18 at 3:37











  • So .utility is inside the <header> ?

    – Amy Lee
    Nov 23 '18 at 3:38











  • If it is i think you should place it outside the header, cause position fixed isn't the same as relative

    – Amy Lee
    Nov 23 '18 at 3:39











  • .utility{ position:absolute; right:10px; width:700px; height:20px; padding-top:10px; z-index:1000; top: 0px; } doesn't work

    – Joseph Marini
    Nov 23 '18 at 3:43



















it doesn't seem to be working. I have changed the header to fixed and .utility(child element) to absolute.

– Joseph Marini
Nov 23 '18 at 3:35







it doesn't seem to be working. I have changed the header to fixed and .utility(child element) to absolute.

– Joseph Marini
Nov 23 '18 at 3:35















Did you add top: xx px on the absolute? or margin-top: xx px on the absolute element?

– Amy Lee
Nov 23 '18 at 3:37





Did you add top: xx px on the absolute? or margin-top: xx px on the absolute element?

– Amy Lee
Nov 23 '18 at 3:37













So .utility is inside the <header> ?

– Amy Lee
Nov 23 '18 at 3:38





So .utility is inside the <header> ?

– Amy Lee
Nov 23 '18 at 3:38













If it is i think you should place it outside the header, cause position fixed isn't the same as relative

– Amy Lee
Nov 23 '18 at 3:39





If it is i think you should place it outside the header, cause position fixed isn't the same as relative

– Amy Lee
Nov 23 '18 at 3:39













.utility{ position:absolute; right:10px; width:700px; height:20px; padding-top:10px; z-index:1000; top: 0px; } doesn't work

– Joseph Marini
Nov 23 '18 at 3:43







.utility{ position:absolute; right:10px; width:700px; height:20px; padding-top:10px; z-index:1000; top: 0px; } doesn't work

– Joseph Marini
Nov 23 '18 at 3:43






















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440172%2fz-index-on-a-absolute-container-in-a-fixed-containter%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()