z-index usage in astro #3574
|
Hello If I want to use z-index in a component inside my markdown, it's not working. For example, if I want to use a component that can be in full screen, I will still see the sidebar and the top nav The problem is that there is some CSS defitions that "disable" the z-index inside the main content @layer starlight.base {
:root,
::backdrop {
/* ...... */
--sl-z-index-toc: 4;
--sl-z-index-menu: 5;
--sl-z-index-navbar: 10;
--sl-z-index-skiplink: 20;
}
}in packages/starlight/style/props.css Questions
SuggestionsA possible solution would be to scope the css z-index with a default class - meaning "if a class is enabled, use the z-index". Or with a frontmatter property like https://developer.mozilla.org/en-US/docs/Web/API/Element/classList |
Replies: 1 comment 2 replies
|
We intentionally isolate the main content stacking context using starlight/packages/starlight/components/TwoColumnContent.astro Lines 16 to 18 in 37d0af0 This avoids that broken looking thing where some content suddenly scrolls above the site UI because of I think for something that can be full screen I would do one of the following:
If neither of those are possible, I guess you could also temporarily toggle on/off the |
We intentionally isolate the main content stacking context using
isolation: isolateto prevent it ever displaying above the navgation bar, sidebar, etc:starlight/packages/starlight/components/TwoColumnContent.astro
Lines 16 to 18 in 37d0af0
This avoids that broken looking thing where some content suddenly scrolls above the site UI because of
z-indexvalues.I think for something that can be full screen I would do one of the following:
<dialog>element which pops up and covers the full screen. This would use the “top layer” and not be subjec…