Cannot make <div> object appear ontop of everything


#1

Hello, this is my site: https://siniparksi.gr/ (please note it is locked for public access, user: admin - pass: adminadmin123).

There is a triangle at the top right corner of the page which is supposed to be a dropdown menu on hover, but i can’t make it show up. It looks like contents are hidden beneath. I already tried z-index, but can’t make it. Could someone help me out?

Thanks


#2

I can offer some hints, but not a copy-n-paste fix. To me, it looks like a mish-mash of “fun with z-indexes” and “absolute positioning”… and Wordpress’ jungle of imports.

Caveats: I tested with Javascript disabled and I am not familiar with Wordpress.

The following elements affect the issue. (That does not mean that they are part of the problem. You still have to solve the problem.):

https://siniparksi.gr/wp-content/themes/siniparksiwp3/style.css(line 56)

.topnav_dropdown .topnav_menu {
    background-color: #336601;  /* TEMP add me.  This gives me a solid background color behind the drop-downs.  The background-color is probably added by JS on hover. */
    left: 0;
    margin: 0;
/*    position: absolute;  /* comment out */
    top: 100%;
}

https://siniparksi.gr/wp-content/themes/siniparksiwp3/style.css (line 594)

.art-shapes {
    background: #336601 none repeat scroll 0 0;
    bottom: 0;
    left: 0;
/*    overflow: hidden;  /* comment out */
    position: absolute;
    right: 20px;
    top: 0;
/*    z-index: 0;  /* comment out */
}

FWIW, making the above changes makes the dropdown permanently visible.

Also, for what it’s worth, if this is the “local” or “child” style CSS file and not one of the master CSS files, it should be the last CSS file called in the cascade, not the first. You’ll find that you don’t need nearly as many !importants when the master styles are properly overridden on the local style sheet.


#3

Thank you very much, ronpat.

I will try to fix it following your advice.


#4

Hello!

I made it, it works now quite good. Thank you for that, your help was valuable!
Just a little more help, if you don’t mind?

Fixing this probably broke something else (or maybe i did by mistake) because at the same time i was working on making the menu headers always visible, but now it looks like the menu header (on mobile version) goes behing the content… (.responsive .artheader has position:fixed)


#5

Remember that I am using Firefox with JS disabled.

The top menus both disappear at mobile widths for me.
This occurs because of the following media query at the top of the home page:

@media screen and (max-width: 769px) {

            .art-shapes, .responsive art-header-bg, .art-nav {
            display: none !important;
        }
}

Two screen shots illustrate what I see:

I don’t think you intend for both menus to disappear, but that is what is happening.

I changed the color of the background from pale yellow to gray so you can see that the the menu items are wrapping prematurely, as well as the text in two links further down the right column. You may want to give them some attention.

I noticed that the style.css file is still at the top of the list of style sheets instead of being the last style sheet in the cascade. Moving it to the end of the stylesheets will very likey break some of your design and require rework, but it should never have been placed at the top of the list to begin with.

Because I am neither a Javascript nor Wordpress person, it would be best if someone else could pitch in and assist with this topic if you need to continue here.


#6

It is true a lot of things are very badly made :frowning: I’m not an expert, so i’m trying to do my best, studying online and actually doing trial-n-error work. I am talking about the mobile menu, which shows up either on phones or if you resize your browser to a very narrow resolution. From your screenshot it looks like it works, though. It could be because you’re blocking JS? I don’t know. In my case it looks like this:

The green section that can be barely seen is the menu header, which is supposed to be ontop of everything.


#7

Any chance that line 934 is the culprit? or at least a clue to the problem?

comment out position:fixed and see how it behaves.

.responsive .art-header {
    background: #336601 url("https://siniparksi.gr/wp-content/uploads/2018/09/logo_yellow-e1536856194904.png") repeat scroll left center;
/*    position: fixed; /* */
}

#8

Well, yes, this brings the header in front, but then it just scrolls away as your scroll down the page. It’s not “sticky”.


#9

Yeah, that was not a very good guess.

Here’s another to consider… (again, not a fix, but maybe a clue).

https://siniparksi.gr/wp-content/themes/siniparksiwp3/style.responsive.css?ver=4.9.9 (line 99)
(this looks like a WP master so “width:auto” needs to be properly overridden.)

.responsive .art-header {
    background-position: 5% 9px !important;
    background-repeat: no-repeat !important;
    background-size: 5.3em 1.95em !important;
    height: 10px;
    left: 0;
    min-height: 56px;
    min-width: 1%;
/*    width: auto;  /* comment out */
}

#10

You are so good at this :slight_smile:

You can see it looks much better now. The pale font has gone behing the header, although the content is still in front of it.


#11

Try this. See what breaks. :slightly_smiling_face:

style (line 1376)

.art-layout-wrapper {
/*    margin: 0 auto; /* comment out */
/*    position: relative; /* comment out */
/*    z-index: auto !important; /* comment out */
    padding-top: 34px; /* ADD Me */
}

#12

Well, nothing breaks (as far as i can see). I can guess you moved the content lower by padding it 34px. It’s still ontop of the header though :confused: Which is weird because in theory content wrapper contains everything


#13

Ah, ha.

It’s the old ID vs class competition.

#art-main {
    background: #f9f9ec none repeat scroll 0 0;
    cursor: default;
    font-family: "FiraSans";
    font-size: 1.2em;
    font-style: normal;
    font-weight: 500;
    left: 0;
    line-height: 1.25em;
    margin: 0 auto;
    min-height: 100%;
    min-width: 80%;
    overflow: hidden;
    position: relative;
    top: 0;
    width: 100%;
    z-index:-1;  /* ADD Me */
}

#art-main is an ID. As such, none of these properties can be changed or overridden easily which is one reason you are using !important so many times. art-main should be a className, if possible, OR the element should be given a className in addition to the ID and the properties should be assigned to the className

As a good rule of thumb, ID’s should not be used unless needed by JS, fragment identifiers, link targets, etc.

Next:

https://siniparksi.gr/wp-content/themes/siniparksiwp3/style.css
(line 3186)

.art-content {
    position: relative;
    z-index: -1;  /* ADD Me */
}

I don’t know if these changes “break” anything, so be sure to test thoroughly. You might want to keep the added padding from the previous test. It won’t hurt.


#16

This totally fixes everything, thanks so much!

It does break things - i can see all links are not clickable anymore, but i think this is something i will figure out.


#17

Nope… Negative z-index values causes the whole page to go dead. No links, nowhere. But they fix the issue with the header.

Does that mean i have to change all z-indexes from scratch??


#18

Can you please restore the code for your site to the state that it was in when you first posted? In other words, remove any changes that I tried that might still exist including the latest z-index changes. I want to look at it again from scratch.


#19

Yes, of course… Are you sure you wanna get into this? Isnt a trouble for you?


#20

Because i think i can handle


#21

I’m definitely out of my element with WP sites. But if you have the patience, I would like to look at the code again from scratch.


#22

It’s nothing about patience. Of course i have it. Just didn’t wanna put you in more trouble because you already helped me so much.

I have undone the changes to z-index (#13), commenting out wrapper elements (#11) and header width (#9). So it’s all back to when content appears in front of the menu bar.