{"id":1079,"date":"2009-12-02T11:36:44","date_gmt":"2009-12-02T18:36:44","guid":{"rendered":"http:\/\/www.vanseodesign.com\/?p=1079"},"modified":"2009-12-02T11:36:44","modified_gmt":"2009-12-02T18:36:44","slug":"css-stack-z-index","status":"publish","type":"post","link":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/","title":{"rendered":"Z-Index And The CSS Stack: Which Element Displays First?"},"content":{"rendered":"<p>Z-index is another css property that appears simple on the surface, but has some deeper rules that can cause confusion.<\/p>\n<p>On the surface it may seem as simple as a positive z-index sits in front of a 0 z-index, which sits in front of a negative z-index. While that is true, there&#8217;s more to the overall equation about how a browser decides which elements display in front of others.<br \/>\n<!--more--><br \/>\nIn last week&#8217;s post on <a href=\"http:\/\/www.vanseodesign.com\/css\/css-positioning\/\">css positioning<\/a> I touched on the z-index property and mentioned it was more complex than my brief description allowed and that the details would be for another post. This is that more detailed post.<\/p>\n<p><strong>Note:<\/strong> z-index only works on positioned elements so if this is new to you, I suggest reading the positioning post linked to above first and then coming back here to learn about z-index.<\/p>\n<h2>What is the Z-index?<\/h2>\n<p>Let&#8217;s start with a quick review. If you read the previous css positioning post you can probably skip to the next section.<\/p>\n<p>A web page is a two dimensional plane with width and height. Z-index is the missing third dimension, depth, with an axis that moves in and out of your monitor. <a href=\"http:\/\/www.smashingmagazine.com\/2009\/09\/15\/the-z-index-css-property-a-comprehensive-look\/\">Z-index<\/a> allows us to break out of the plane of the page and stack elements on top of each other.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/11\/z-index.png\" alt=\"z-index.png\" width=\"465\" height=\"419\" \/><\/p>\n<p>A higher z-index moves toward the front of the page. It wants to reach out of the monitor and into your living room. A lower z-index recedes toward the back of the page away from your living room. If two elements are positioned to occupy the same space in the two dimensional plane and one has a z-index of 10 while the other has a z-index of 5, we would expect to see the z-index 10 element in front of the z-index 5 element.<\/p>\n<p>The <a href=\"http:\/\/www.w3schools.com\/Css\/pr_pos_z-index.asp\">z-index property<\/a> can take one of 3 values:<\/p>\n<ul>\n<li><strong>auto<\/strong> &#8211; <em>(default)<\/em> Sets the stack order of the element to be equal to the stack order of the element&#8217;s parent.<\/li>\n<li><strong>number<\/strong> &#8211; Can be a positive number, a negative number, or 0. Sets the stack order for the element<\/li>\n<li><strong>inherit<\/strong> &#8211; Sets the z-index to the same as that of the parent element<\/li>\n<\/ul>\n<p>The quick definitions of the values above are only so useful. To really understand what&#8217;s going on we need to discuss the stack.<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/7989285@N07\/3002914861\/\" title=\"sour like a stone\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm4.static.flickr.com\/3293\/3002914861_7e282f0b42_m.jpg\" alt=\"sour like a stone\" width=\"465\" height=\"310\" \/><\/a><br \/><small><a href=\"http:\/\/creativecommons.org\/licenses\/by\/2.0\/\" title=\"Attribution License\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/plugins\/photo-dropper\/images\/cc.png\" alt=\"Creative Commons License\" border=\"0\" width=\"16\" height=\"16\" align=\"absmiddle\" \/><\/a> <a href=\"http:\/\/www.photodropper.com\/photos\/\" target=\"_blank\">photo<\/a> credit: <a href=\"http:\/\/www.flickr.com\/photos\/7989285@N07\/3002914861\/\" title=\"Demion\" target=\"_blank\">Demion<\/a><\/small><\/p>\n<h2>Stacking Contexts and Stacking Levels<\/h2>\n<p>Every css box has three dimensions along the horizontal, vertical, and z axis. When a browser is rendering your design elements along the z-axis it has to decide which element to draw on the canvas first. This order is described in terms of stacking contexts and stacking levels. You can think of a stacking level as being a new layer on the page, but what about this stacking context.<\/p>\n<p><a href=\"http:\/\/www.w3.org\/TR\/CSS21\/zindex.html\">Stacking contexts<\/a> can be a little confusing.<\/p>\n<blockquote><p>\nThe root element (html) forms the root stacking context. Other stacking contexts are generated by any positioned element (including relatively positioned elements) having a computed value of &#8216;z-index&#8217; other than &#8216;auto&#8217;. Stacking contexts are not necessarily related to containing blocks.<br \/>\n<br \/><em>&#8212;<a href=\"http:\/\/www.w3.org\/TR\/CSS21\/visuren.html#layers\">w3.org<\/a><\/em>\n<\/p><\/blockquote>\n<p>Sure that&#8217;s clear.<\/p>\n<p>The basic idea is there is one stacking context created by default with any web page. The root of that stacking context is the html element and elements inside that stacking context (everything inside the page) are located on different stacking levels within that default context.<\/p>\n<p>When you add css positioning to an element <strong>and<\/strong> give it a z-index (other than auto) it creates new stacking context with new stacking levels inside the new context.<\/p>\n<p>The z-index value creates a new integer stacking level for that element with a position along the z-axis set relative to the other boxes <em>within the same stacking context<\/em>.<\/p>\n<p>Z-index is only one type of stacking level within a stacking context and the levels are rendered according to a set of stacking order rules, which will get to next.<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/62021300@N00\/2554100852\/\" title=\"More Water Bottle Caps\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm4.static.flickr.com\/3046\/2554100852_0aafaa90c6_m.jpg\" alt=\"More Water Bottle Caps\" width=\"465\" height=\"349\" \/><\/a><br \/><small><a href=\"http:\/\/creativecommons.org\/licenses\/by\/2.0\/\" title=\"Attribution License\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/plugins\/photo-dropper\/images\/cc.png\" alt=\"Creative Commons License\" border=\"0\" width=\"16\" height=\"16\" align=\"absmiddle\" \/><\/a> <a href=\"http:\/\/www.photodropper.com\/photos\/\" target=\"_blank\">photo<\/a> credit: <a href=\"http:\/\/www.flickr.com\/photos\/62021300@N00\/2554100852\/\" title=\"Incase Designs\" target=\"_blank\">Incase Designs<\/a><\/small><\/p>\n<h2>Stacking Order<\/h2>\n<p>I know some (or maybe all) of the above discussion on stacking contexts and stacking levels is confusing. Hopefully you&#8217;re still with me, because the <a href=\"https:\/\/developer.mozilla.org\/en\/understanding_css_z-index\">stacking order<\/a> helps tie things together.<\/p>\n<p>To understand the stacking order let&#8217;s build up the rules slowly by not considering z-index at all at first. In fact let&#8217;s look at only two levels in the stacking order to start and then see where new levels fit in the order<\/p>\n<ol>\n<li>Background and borders of the root element of the stacking context<\/li>\n<li>Descendant block boxes in the normal flow, in order of appearance (in the html)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/12\/stack-1.png\" alt=\"stack-1.png\" border=\"0\" width=\"149\" height=\"162\" class=\"centered\"\" \/><\/p>\n<p>Remember the root of all root stacking contexts is the html element. Looking at the above you&#8217;ll see that the background and borders of the html element represent the lowest level of the stack. A <a href=\"http:\/\/www.instantshift.com\/2009\/11\/16\/css-box-model-the-foundation-for-improving-your-css\/#comments\"> css block box<\/a> (a div inside your html for example) would be at a higher level within the stack.<\/p>\n<p>Makes sense. If you add a background to your html and then fill a div with content inside your html, you&#8217;d expect the div content to be in front of the the html background.<\/p>\n<p>Let&#8217;s start adding more levels to the stacking order<\/p>\n<ol>\n<li>Background and borders of the root element of the stacking context<\/li>\n<li>Descendant block boxes in the normal flow, in order of appearance (in the html)<\/li>\n<li>Descendant positioned elements, in order of appearance (in html)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/12\/stack-2.png\" alt=\"stack-2.png\" border=\"0\" width=\"184\" height=\"215\" class=\"centered\" \/><\/p>\n<p>Positioned elements without z-index applied or z-index: 0 are on a higher stacking level than non-positioned elements. Even if you don&#8217;t specify a z-index (default becomes auto) your positioned element will appear on a higher layer than block level elements in the normal document flow.<\/p>\n<ol>\n<li>Background and borders of the root element of the stacking context<\/li>\n<li>Descendant block boxes in the normal flow, in order of appearance (in the html)<\/li>\n<li>Floating blocks <\/li>\n<li>Descendant positioned elements, in order of appearance (in html)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/12\/stack-3.png\" alt=\"stack-3.png\" border=\"0\" width=\"220\" height=\"257\" class=\"centered\" \/><\/p>\n<p>Floated elements have a higher stacking level than block level elements in the normal document flow, but a lower stacking level than positioned elements without z-index applied.<\/p>\n<ol>\n<li>Background and borders of the root element of the stacking context<\/li>\n<li>Descendant block boxes in the normal flow, in order of appearance (in the html)<\/li>\n<li><a href=\"http:\/\/www.vanseodesign.com\/css\/understanding-css-floats\/\">Floating blocks<\/a><\/li>\n<li>Descendant inline boxes in the normal flow, in order of appearance (in the html)<\/li>\n<li>Descendant positioned elements, in order of appearance (in html)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/12\/stack-4.png\" alt=\"stack-4.png\" border=\"0\" width=\"252\" height=\"293\" class=\"centered\" \/><\/p>\n<p>Notice that inline boxes have a higher stacking level than both block boxes and floated boxes, which you might not expect.<\/p>\n<p>Now lets put the z-index back in and get the full stacking order rules as define by the w3C.<\/p>\n<ol>\n<li>the background and borders of the element forming the stacking context.<\/li>\n<li>the stacking contexts of descendants with negative stack levels. (negative z-index)<\/li>\n<li>a stacking level containing in-flow non-inline-level non-positioned descendants. (block level boxes in the normal document flow)<\/li>\n<li>a stacking level for non-positioned floats and their contents. (floated boxes)<\/li>\n<li>a stacking level for in-flow inline-level non-positioned descendants. (inline boxes)<\/li>\n<li>a stacking level for positioned descendants with &#8216;z-index: auto&#8217;, and any descendant stacking contexts with &#8216;z-index: 0&#8217;.<\/li>\n<li>the stacking contexts of descendants with positive stack levels. (positive z-index)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/12\/stack-5.png\" alt=\"stack-5.png\" border=\"0\" width=\"236\" height=\"376\" class=\"centered\" \/><\/p>\n<p>A few things stand out in the final stacking order. As you might expect an element with a positive z-index appears at the top of the stack and while not specifically mentioned the higher the z-index the higher the level in the stack order.<\/p>\n<p>What is less expected is that boxes with negative z-indexes are still higher in the stacking order than the background and borders of the element forming the stacking context. Remember that element forming the stacking context is likely the element you just added z-index to.<\/p>\n<p>Also it&#8217;s interesting where boxes with a z-index of 0 or auto lie in the stacking order. There are several stacking levels below your z-index: 0 element, which you might not expect.<\/p>\n<p>The main thing to understand about the stacking order is that more than the z-index value goes into determining what layer in the stack an element is on.<\/p>\n<h2>Browser Issues with the Stacking Order<\/h2>\n<p>In a perfect world we&#8217;d be done. It&#8217;s not a perfect world as you know and in the context of z-index it&#8217;s browsers that are imperfect. I mentioned two of these in my last post, but they bear repeating<\/p>\n<p>1. Select boxes in IE6 &#8211; In IE6 a select box &lt;select&gt; will always appear at the top of the stack. You can set all the z-indexes you want, but the select box will still be at the top.<\/p>\n<p>2. E6 and IE7 have another z-index issue with stacking context. IE looks to the outermost parent with positioning applied to determine which group of elements is at the top of the stack instead of looking at each individual element.<\/p>\n<p>{code type=html}<\/p>\n<div style=\"z-index: 0;\">\n<p style=\"z-index: 10;\">\n<\/div>\n<p><img style=\"z-index: 5;\" \/><br \/>\n{\/code}<\/p>\n<p>You would expect the paragraph to be at the top of the stack, because it has the highest z-index. However IE6 and IE7 would place the image on top of the paragraph, because it sees two different stacks. One for the div and one for the image. The image has a higher z-index than the div and so will sit on top of everything inside the div.<\/p>\n<p>3. Firefox 2 and negative z-index &#8211; FF is not immune from browser issues. Firefox 2 always places an element with a negative z-index behind the entire stacking context instead of above the background and borders of the root of the stacking context.<\/p>\n<h2>Summary<\/h2>\n<p><a href=\"http:\/\/www.impressivewebs.com\/a-detailed-look-at-the-z-index-css-property\/\">Z-index<\/a> is a little more complex than it first appears. It gets even more complex when you try to explain it. I hope I didn&#8217;t confuse you in trying to explain <a href=\"http:\/\/css-tricks.com\/video-screencasts\/40-how-z-index-works\/\">how z-index works<\/a>.<\/p>\n<p>The main points to remember are that css uses stacking contexts and stacking levels within each of those stacking contexts. CSS also describes a stacking order for which level appears in front of or behind the others around it. Z-index accounts for 3 stacking levels, but there are other stacking levels as well.<\/p>\n<p>By default your html element creates a stacking context and then each time you use css positioning and give the element a z-index you create a new stacking context with it&#8217;s own stacking levels and stacking order. While not too difficult to understand where one element will display inside one stacking context, it can be somewhat confusing when comparing different levels in different stacking contexts.<\/p>\n<p>The more positive the z-index the more in front the element appears. The more negative the z-index the further away it appears. However other stacking levels are intertwined with the three z-index stacking levels.<\/p>\n<p>If you&#8217;ve ever tried to use z-index and found things not quite working like you expected the answer to why is likely in the stacking order (or occasionally an imperfect browser)<\/p>\n<p>Questions?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Z-index is another css property that appears simple on the surface, but has some deeper rules that can cause confusion. On the surface it may seem as simple as a positive z-index sits in front of a 0 z-index, which sits in front of a negative z-index. While that is true, there&#8217;s more to the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"series":[],"class_list":["post-1079","post","type-post","status-publish","format-standard","hentry","category-css"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Z-Index And The CSS Stack: Which Element Displays First? - Vanseo Design<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Z-Index And The CSS Stack: Which Element Displays First? - Vanseo Design\" \/>\n<meta property=\"og:description\" content=\"Z-index is another css property that appears simple on the surface, but has some deeper rules that can cause confusion. On the surface it may seem as simple as a positive z-index sits in front of a 0 z-index, which sits in front of a negative z-index. While that is true, there&#8217;s more to the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/\" \/>\n<meta property=\"og:site_name\" content=\"Vanseo Design\" \/>\n<meta property=\"article:published_time\" content=\"2009-12-02T18:36:44+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/11\/z-index.png\" \/>\n<meta name=\"author\" content=\"Steven Bradley\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Steven Bradley\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/\"},\"author\":{\"name\":\"Steven Bradley\",\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/#\\\/schema\\\/person\\\/470cda6ba835fb52596b2e26bcbd8fe4\"},\"headline\":\"Z-Index And The CSS Stack: Which Element Displays First?\",\"datePublished\":\"2009-12-02T18:36:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/\"},\"wordCount\":757,\"commentCount\":44,\"image\":{\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.vanseodesign.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/11\\\/z-index.png\",\"articleSection\":[\"CSS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/\",\"url\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/\",\"name\":\"Z-Index And The CSS Stack: Which Element Displays First? - Vanseo Design\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.vanseodesign.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/11\\\/z-index.png\",\"datePublished\":\"2009-12-02T18:36:44+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/#\\\/schema\\\/person\\\/470cda6ba835fb52596b2e26bcbd8fe4\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/#primaryimage\",\"url\":\"http:\\\/\\\/www.vanseodesign.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/11\\\/z-index.png\",\"contentUrl\":\"http:\\\/\\\/www.vanseodesign.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/11\\\/z-index.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/css-stack-z-index\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vanseodesign.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS\",\"item\":\"https:\\\/\\\/vanseodesign.com\\\/css\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Z-Index And The CSS Stack: Which Element Displays First?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/#website\",\"url\":\"https:\\\/\\\/vanseodesign.com\\\/\",\"name\":\"Vanseo Design\",\"description\":\"Helping you build search engine friendly websites\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vanseodesign.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/vanseodesign.com\\\/#\\\/schema\\\/person\\\/470cda6ba835fb52596b2e26bcbd8fe4\",\"name\":\"Steven Bradley\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"\\\/\\\/www.gravatar.com\\\/avatar\\\/0f47bf400c3c1bafe06ee2884405baaa?s=96&#038;r=pg&#038;d=https%3A%2F%2Fvanseodesign.com%2Fblog%2Fwp-content%2Fthemes%2Fvanseo-design%2Fimages%2Fgravatar.png\",\"url\":\"\\\/\\\/www.gravatar.com\\\/avatar\\\/0f47bf400c3c1bafe06ee2884405baaa?s=96&#038;r=pg&#038;d=https%3A%2F%2Fvanseodesign.com%2Fblog%2Fwp-content%2Fthemes%2Fvanseo-design%2Fimages%2Fgravatar.png\",\"contentUrl\":\"\\\/\\\/www.gravatar.com\\\/avatar\\\/0f47bf400c3c1bafe06ee2884405baaa?s=96&#038;r=pg&#038;d=https%3A%2F%2Fvanseodesign.com%2Fblog%2Fwp-content%2Fthemes%2Fvanseo-design%2Fimages%2Fgravatar.png\",\"caption\":\"Steven Bradley\"},\"sameAs\":[\"https:\\\/\\\/www.vanseodesign.com\\\/about\\\/\"],\"url\":\"https:\\\/\\\/vanseodesign.com\\\/author\\\/vangogh\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Z-Index And The CSS Stack: Which Element Displays First? - Vanseo Design","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/","og_locale":"en_US","og_type":"article","og_title":"Z-Index And The CSS Stack: Which Element Displays First? - Vanseo Design","og_description":"Z-index is another css property that appears simple on the surface, but has some deeper rules that can cause confusion. On the surface it may seem as simple as a positive z-index sits in front of a 0 z-index, which sits in front of a negative z-index. While that is true, there&#8217;s more to the [&hellip;]","og_url":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/","og_site_name":"Vanseo Design","article_published_time":"2009-12-02T18:36:44+00:00","og_image":[{"url":"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/11\/z-index.png","type":"","width":"","height":""}],"author":"Steven Bradley","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Steven Bradley","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/#article","isPartOf":{"@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/"},"author":{"name":"Steven Bradley","@id":"https:\/\/vanseodesign.com\/#\/schema\/person\/470cda6ba835fb52596b2e26bcbd8fe4"},"headline":"Z-Index And The CSS Stack: Which Element Displays First?","datePublished":"2009-12-02T18:36:44+00:00","mainEntityOfPage":{"@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/"},"wordCount":757,"commentCount":44,"image":{"@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/#primaryimage"},"thumbnailUrl":"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/11\/z-index.png","articleSection":["CSS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vanseodesign.com\/css\/css-stack-z-index\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/","url":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/","name":"Z-Index And The CSS Stack: Which Element Displays First? - Vanseo Design","isPartOf":{"@id":"https:\/\/vanseodesign.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/#primaryimage"},"image":{"@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/#primaryimage"},"thumbnailUrl":"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/11\/z-index.png","datePublished":"2009-12-02T18:36:44+00:00","author":{"@id":"https:\/\/vanseodesign.com\/#\/schema\/person\/470cda6ba835fb52596b2e26bcbd8fe4"},"breadcrumb":{"@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vanseodesign.com\/css\/css-stack-z-index\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/#primaryimage","url":"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/11\/z-index.png","contentUrl":"http:\/\/www.vanseodesign.com\/blog\/wp-content\/uploads\/2009\/11\/z-index.png"},{"@type":"BreadcrumbList","@id":"https:\/\/vanseodesign.com\/css\/css-stack-z-index\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vanseodesign.com\/"},{"@type":"ListItem","position":2,"name":"CSS","item":"https:\/\/vanseodesign.com\/css\/"},{"@type":"ListItem","position":3,"name":"Z-Index And The CSS Stack: Which Element Displays First?"}]},{"@type":"WebSite","@id":"https:\/\/vanseodesign.com\/#website","url":"https:\/\/vanseodesign.com\/","name":"Vanseo Design","description":"Helping you build search engine friendly websites","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vanseodesign.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/vanseodesign.com\/#\/schema\/person\/470cda6ba835fb52596b2e26bcbd8fe4","name":"Steven Bradley","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"\/\/www.gravatar.com\/avatar\/0f47bf400c3c1bafe06ee2884405baaa?s=96&#038;r=pg&#038;d=https%3A%2F%2Fvanseodesign.com%2Fblog%2Fwp-content%2Fthemes%2Fvanseo-design%2Fimages%2Fgravatar.png","url":"\/\/www.gravatar.com\/avatar\/0f47bf400c3c1bafe06ee2884405baaa?s=96&#038;r=pg&#038;d=https%3A%2F%2Fvanseodesign.com%2Fblog%2Fwp-content%2Fthemes%2Fvanseo-design%2Fimages%2Fgravatar.png","contentUrl":"\/\/www.gravatar.com\/avatar\/0f47bf400c3c1bafe06ee2884405baaa?s=96&#038;r=pg&#038;d=https%3A%2F%2Fvanseodesign.com%2Fblog%2Fwp-content%2Fthemes%2Fvanseo-design%2Fimages%2Fgravatar.png","caption":"Steven Bradley"},"sameAs":["https:\/\/www.vanseodesign.com\/about\/"],"url":"https:\/\/vanseodesign.com\/author\/vangogh\/"}]}},"_links":{"self":[{"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/posts\/1079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/comments?post=1079"}],"version-history":[{"count":0,"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/posts\/1079\/revisions"}],"wp:attachment":[{"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/media?parent=1079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/categories?post=1079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/tags?post=1079"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/vanseodesign.com\/wp-json\/wp\/v2\/series?post=1079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}