Z-index on a absolute container in a fixed containter
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
|
show 1 more comment
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
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
|
show 1 more comment
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
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
z-index
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
|
show 1 more comment
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
|
show 1 more comment
1 Answer
1
active
oldest
votes
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,
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
|
show 4 more comments
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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,
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
|
show 4 more comments
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,
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
|
show 4 more comments
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,
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,
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
|
show 4 more comments
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
|
show 4 more comments
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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