/    Sign up×
Community /Pin to ProfileBookmark

OpenCart CSS: why is my dropdown menu stacked behind the fixed header?

The OpenCart default layout has a topbar with “account” and “shopping-cart” links. I made its position fixed so it would stay on top of the browser window when the user scrolls down the page.
`#topbar { height:32px; position:fixed; z-index:1; }`

The layout also has a header which I gave a fixed position and a top margin of 32px (the height of the topbar) so it would stick on top too, right below the topbar.
`#header { height:75px; position:fixed; margin-top:32px; z-index:2; }`

I gave each positioned object a z-index to stack the topbar on top of all other content, but a problem arises: the topbar has a dropdown menu which is now stacked behind the header. I tried different z-indexes but nothing seems to work here. The topbar dropdown menu stays behind the header.

What can I do about this?

**Edit:**
I tried giving the dropdown menu different positions (relative, static, fixed) and z-indexes too and I also gave both elements a background color, border and text color but I don’t think this has anything to do with the problem so I did not put it in the code above.

to post a comment
CSSFull-stack DeveloperHTML

0Be the first to comment 😎

×

Success!

Help @jonagoldapple spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...