Fixed position and z-index

Yes, those fixed-positioned elements are annoying; please bear with me.

The two fixed-position divs on this page are marked up as:

<div class="fixed" id="green"></div>
<div class="fixed" id="orange"></div>

and styled thus:

.fixed { width: 50%; margin: 0 auto; height: 50px;
    position: fixed; }

#green  { top: 50px; background-color: #CEE14B; }
#orange { top: 110px; background-color: #FCAF3E; z-index: 1; }

Note that the lower, orange element has a z-index specified, whilst the first element doesn’t. The ul just below this text has a relative position. When the page is scrolled, and the orange div overlaps that list, all looks fine. When the green div overlaps it, however, the list items are shown in front of it.

Is this a bug, or expected behaviour? I’m really not sure. Comments, please!



Sat 28 Nov 2009 09:57


Danny said:

expected behavior…

Since the green DIV has no z-index priority… it is on the same plane as every other non z-indexed element on the page. The indexing now falls to where it’s placed in the code. Since it’s before the UL list… it has a lower indexing on that plane… If you place the green DIV after the UL list… you'll see that it now goes over the UL list… thus having a higher indexing on that plane…

Fri 22 Jan 2010 12:30


raf said:

Sounds plausible and works as you described, Danny. But how come the paragraph following the list, "Is this a bug…", does not behave the same way? Why does this behaviour only apply to the list?

Sun 24 Jan 2010 11:27

Five Minute Argument

Five Minute Argument said:

@raf: That paragraph is not positioned, so it’s in the normal flow. With no z-index (and, therefore, the deafult value 'auto'), the positioned green div will be rendered 'in front of' any normal-flow block.

z-index gets pretty complicated, especially when nesting blocks or applying a negative value to the property. I think a nice visual example covering the possible cases is called for.

Mon 2 May 2011 13:02


Thanks, you saved my time.

Wed 24 Aug 2011 03:21

Simon Brandon

Simon Brandon said:

You are an absolute star — I've been pulling my hair out trying to get a div to go above a fixed position div for ages, messing around with z-index without success. Just set the div in question to position:relative and it happily slides over the position:fixed div.

Thu 13 Oct 2011 13:44

Jonathan Gala

Jonathan Gala said:

Nice illustration, thanks.

Simon and Five Minute Argument: there is a nice tutorial on z-index (and some bugs in earlier IE implementations) here:

… that’s not my site, btw, but it’s a good overview, with nicely prepared examples. It helped my understanding of z-index a lot.

Wed 14 Dec 2011 01:21


Jim said:

Thanks for raising this issue along with an example — and thanks a lot Danny for answering it. Perfect!



Sat 13 Dec 2014 12:11

non prescription cialis online pharmacy

non prescription cialis online pharmacy said:

Hi there, I enjoy reading all of your post. I like to write a

little comment to support you.

Mon 15 Dec 2014 21:23

generic cialis canada

generic cialis canada said:

Your means of explaining all in this post is genuinely good, all be capable

of effortlessly understand it, Thanks a lot.

Fri 19 Dec 2014 01:46

north west pharmacy canada

north west pharmacy canada said:

WOW just what I was looking for. Came here by searching for canadian prescription drugs

without prescription

Sat 20 Dec 2014 09:41

canadian cialis pills

canadian cialis pills said:

Thanks for the auspicious writeup. It actually was a leisure account it.

Glance advanced to far delivered agreeable from you!

By the way, how can we keep in touch?

Sat 20 Dec 2014 09:51

cialis 20mg

cialis 20mg said:

excellent submit, very informative. I wonder why the opposite specialists of this sector do not realize this.

You must continue your writing. I am sure, you have a great readers' base already!

Wed 24 Dec 2014 16:24

cialis com

cialis com said:

Greetings! Very helpful advice within this post!

It is the little changes that will make the biggest changes.

Many thanks for sharing!

Tue 30 Dec 2014 01:43

canadian cialis

canadian cialis said:

Hello colleagues, its great paragraph concerning tutoringand entirely defined, keep it up all the time.

Tue 30 Dec 2014 06:03

goodrx coupons

goodrx coupons said:

Hi there, I found your site via Google even as searching for

a comparable topic, your web site came up, it appears good.

I've bookmarked it in my google bookmarks.

Hi there, just was aware of your weblog thru Google, and located

that it is truly informative. I’m going to be careful for brussels.

I will be grateful if you happen to continue this in future.

Numerous other folks can be benefited from

your writing. Cheers!

Tue 30 Dec 2014 06:46

canada pharmacy online viagra

canada pharmacy online viagra said:

I loved as much as you will receive carried out right here.

The sketch is attractive, your authored

material stylish. nonetheless, you command get got an nervousness over

that you wish be delivering the following. unwell unquestionably come more formerly again as exactly the same nearly a lot often inside case you shield this increase.

Thu 1 Jan 2015 10:25


northwestpharmacy said:

Hurrah, that’s what I was searching for, what a data! existing here at this webpage, thanks

admin of this web site.

Thu 8 Jan 2015 10:39

north west pharmacy canada

north west pharmacy canada said:

Hiya! Quick question that’s entirely off topic. Do you know how to make your site mobile

friendly? My blog looks weird when viewing from my iphone.

I’m trying to find a template or plugin that

might be able to fix this problem. If you have any recommendations, please share.

Thank you!

Mon 12 Jan 2015 20:49

online pharmacy cialis

online pharmacy cialis said:

Hey! I just wanted to ask if you ever have any problems with hackers?

My last blog (wordpress) was hacked and I ended up losing many months of hard work

due to no backup. Do you have any solutions to stop


Tue 13 Jan 2015 13:25


bvhitud said:


Wed 14 Jan 2015 07:13

cialis daily 5 mg price

cialis daily 5 mg price said:

Very nice article, totally what I needed.

Fri 16 Jan 2015 14:54

Pet medications cheap

Pet medications cheap said:

Useful information. Lucky me I discovered your website by accident,

and I am stunned why this coincidence didn’t took place earlier!

I bookmarked it.

Fri 16 Jan 2015 16:01

Cialis dreampharmaceuticals online

Cialis dreampharmaceuticals online said:

Hi! This post couldn’t be written any better! Reading through this post reminds me of my good old room mate!

He always kept chatting about this. I will forward this post to him.

Fairly certain he will have a good read. Thank you for sharing!

Sat 17 Jan 2015 11:23

Cialis paypal canada

Cialis paypal canada said:

I every time emailed this blog post page to all my contacts, because if like to

read it next my friends will too.

Sun 18 Jan 2015 09:47


hello said:

yzqnzwo <a href=" ">pjbuqyt</a> [url=]pjbuqyt[/url]

Sun 18 Jan 2015 16:22

Cialis online pharmacy uk

Cialis online pharmacy uk said:

Wow, wonderful blog structure! How lengthy have you ever been blogging for?

you made blogging glance easy. The full glance of your site is great,

let alone the content material!

Tue 20 Jan 2015 01:12

payday loans

payday loans said:

byhetfz payday loans >:]] payday loans ZFgZOV payday loans >:]] pay day loans 9582 payday loans 1121 pay day loans 4049

Wed 21 Jan 2015 01:21

walgreens drug store

walgreens drug store said:

Great article, exactly what I needed.

Wed 21 Jan 2015 12:22

how to buy cialis in canada

how to buy cialis in canada said:

Hi it’s me, I am also visiting this web site regularly, this

site is really pleasant and the visitors are truly sharing fastidious thoughts.

Thu 22 Jan 2015 10:08

online pharmacies canada

online pharmacies canada said:

The Commonly used pharmacy is very very affordable whether you are from whichever

parts of the community. The value is affordable

for everyone and anyone; you want to drive of buying it.

At the time verdict is created, look at the best retail store.

Subsequent to purchasing the drugs, you have ingested it.

Just take the drugs with simple standard water. canadian drug

Wed 4 Feb 2015 06:07

canadian drugs

canadian drugs said:

Great goods from you, man. I have remember your stuff prior to and you’re simply too great.

I actually like what you have got right here, really like

what you’re stating and the way in which in which you assert it.

You’re making it entertaining and you continue to take care of to stay

it smart. I can’t wait to learn far more from you.

That is really a tremendous site.

Sun 15 Feb 2015 12:01

canada drugstore online

canada drugstore online said:

Hi, its nice paragraph concerning media print, we all

be familiar with media is a enormous source of information.

Tue 17 Feb 2015 22:22

payday loans

payday loans said:

tzytvzci payday loans 8987 payday loans 4290 payday loan >:-[

Fri 20 Feb 2015 08:57

cialis from canada

cialis from canada said:

Hello i am kavin, its my first time to commenting

anyplace, when i read this article i thought i could also create comment due to this sensible piece of writing.

Sun 22 Feb 2015 13:27

walmart prescription prices

walmart prescription prices said:

This excellent website really has all the information and facts I wanted about this

subject and didn’t know who to ask.

Mon 23 Feb 2015 23:00

buy cialis online canada

buy cialis online canada said:

Nice post. I used to be checking constantly this blog and I am inspired!

Very helpful information particularly the ultimate section :) I maintain such info much.

I was looking for this particular info for a long time.

Thanks and good luck.

Wed 25 Feb 2015 18:37

payday loans

payday loans said:

twgnjcn payday loans >:]] payday loans :-O payday loans =-] payday loans EWTHlZ payday loans 0956 payday loans 0949

Fri 27 Feb 2015 07:01

cialis line order

cialis line order said:

ncwklf cialis line order gFhsZg buy viagra 5363 generic viagra qQcCm generic cialis online :-O buy cialis :-O

Sat 28 Feb 2015 00:08

payday loans

payday loans said:

ecaxyh payday loans >:-[ payday loans RVaAW fast payday loans OheXsV

Sat 14 Mar 2015 13:45

ed drugs

ed drugs said:

I am regular reader, how are you everybody? This piece of writing posted at this web site

is really nice.

Sun 15 Mar 2015 23:07

Ralph Lauren Polo Shirts Outlet

Ralph Lauren Polo Shirts Outlet said:

to prepare flowing. State affects the peel by promoting bloating and puffiness, cellulite and diminution of yob intone.

Sun 15 Mar 2015 23:08

Ray Ban Outlet Sale

Ray Ban Outlet Sale said:

I’m a volunteer wish granter with Make-A-Wish and the kid that met Ray Allen, Colby, was one of my wish kids.

Sun 15 Mar 2015 23:08

Timberland Boots Outlet

Timberland Boots Outlet said:

Oh Shyla I just watch a really sad movie and just when I ccenivond myself that it was just a movie, I come up for a dose of reality.

Sat 28 Mar 2015 21:19


medication said:

This is very interesting, You’re a very skilled blogger. I've joined your feed and

look forward to seeking more of your magnificent post.

Also, I have shared your site in my social networks!

Mon 30 Mar 2015 10:15

payday loans

payday loans said:

kabbtfit payday loans iXXZS payday loans >:-[ payday loans :-O

Thu 2 Apr 2015 16:57

cialis 5mg

cialis 5mg said:

If you are going for finest contents like me, just go to see this website every day for the reason that it presents quality contents, thanks

Fri 3 Apr 2015 13:43


cialis said:

This article presents clear idea designed for the new people of blogging, that

actually how to do running a blog.

Sat 4 Apr 2015 00:17

Polo Outlet Online

Polo Outlet Online said:

I appreciate your point of view. I am looking forward to you have a new article! Good!

Sat 4 Apr 2015 00:19

Ray Ban Outlet Online

Ray Ban Outlet Online said:

I am your loyal fans. I really like your article.

Sat 4 Apr 2015 00:20

TOMS Shoes Outlet Online

TOMS Shoes Outlet Online said:

This is a very good article. I am looking forward to you have a new article!

Mon 6 Apr 2015 05:35

www cialis com coupon

www cialis com coupon said:

For hottest information you have to visit world wide web and on the web I

found this web page as a most excellent web site for hottest updates.

Tue 7 Apr 2015 02:49

internet loans

internet loans said:


Tue 7 Apr 2015 02:50

Loans Store

Loans Store said:

If you are going for finest contents like me, just go to see this website every day for the reason that it presents quality contents, thanks

Sun 12 Apr 2015 00:44

dyson animal vacuum

dyson animal vacuum said:

Link exchange is nothing else except it is simply placing the other

person’s blog link on your page at suitable place and other

person will also do similar in favor of you.

Fri 17 Apr 2015 22:42

Cheap TOMS Shoes

Cheap TOMS Shoes said:

Clear expression is the hallmark of good writing. The article was very meaty. I really like your article.

Fri 17 Apr 2015 23:32

Cheap Ray Ban Sunglasses

Cheap Ray Ban Sunglasses said:

Your article is well written except. I really like your article.

Sun 3 May 2015 16:00

dyson vacuum

dyson vacuum said:

It’s actually a cool and helpful piece of information.

I am glad that you shared this useful info with us. Please keep us informed like this.

Thanks for sharing.

Wed 6 May 2015 21:24

Cialis order from canada

Cialis order from canada said:

I constantly spent my half an hour to read this website’s articles

or reviews every day along with a mug of coffee.

Fri 8 May 2015 03:26

Customer service northwest pharmacy

Customer service northwest pharmacy said:

Nice replies in return of this issue with genuine arguments

and describing the whole thing on the topic of that.

Fri 15 May 2015 14:31

drug information

drug information said:

Ahaa, its pleasant dialogue on the topic of this article at this place at this website, I have read all that,

so now me also commenting at this place.

Fri 15 May 2015 17:01

take cialis best results

take cialis best results said:

Wow, awesome blog layout! How long have you ever been running a blog for?

you make blogging look easy. The entire glance of your website is excellent,

as neatly as the content!

Sun 17 May 2015 02:51

pfizer viagra

pfizer viagra said:

What i don’t realize is if truth be told how you are no longer actually

a lot more well-favored than you might be now. You are so intelligent.

You realize thus significantly on the subject of this topic,

produced me in my opinion consider it from a lot of various angles.

Its like women and men are not interested except it’s one thing

to accomplish with Woman gaga! Your own stuffs outstanding.

At all times care for it up!

Sun 17 May 2015 22:29

Canadian pharmacy

Canadian pharmacy said:

Great goods from you, man. I've understand your stuff previous to

and you are just extremely magnificent. I really like what you have

acquired here, really like what you’re saying and the way in which you say it.

You make it entertaining and you still care for to keep it

wise. I cant wait to read far more from you. This is actually a great web site.

Mon 18 May 2015 02:50

generic cialis

generic cialis said:

gfktfykk generic cialis cjhss cialis line order 8]]] generic viagra >:]] viagra 8]]]

Mon 18 May 2015 13:04


fchdwwgu said:


Tue 19 May 2015 11:47


hello said:

shgbomy <a href=" ">hwzumuwk</a> [url=]hwzumuwk[/url]

Tue 19 May 2015 16:48

canadian pharmacy

canadian pharmacy said:

I really like reading a post that will make people think.

Also, thank you for allowing me to comment!

Tue 26 May 2015 16:34

canadian drugs online

canadian drugs online said:

This is very interesting, You are an overly professional

blogger. I've joined your rss feed and stay up for in quest of

extra of your great post. Also, I have shared your website in my social networks

Wed 27 May 2015 14:56

payday loans

payday loans said:

mblmug payday loans 2962 payday loans 2275 payday loans 7209

Thu 28 May 2015 07:19

canadian pharmacy cialis

canadian pharmacy cialis said:

magnificent put up, very informative. I ponder why the opposite experts of this sector don’t

notice this. You should proceed your writing. I’m confident, you have a great readers' base already!

Thu 28 May 2015 20:13


20150529meiqing said:

Leave a comment