Search code examples
htmlcssfootnotes

HtML Footnote appears behind an element


Newbie here

I'm making a website that has 2 main sections: one larger section (section A) with 75% width, and another section (section B) with 25% width, appear side by side.

Section A has several p tags with footnote inside, the only problem is that when I hover the footnote, it appears behind the section B, can anybody help me? Thanks!

Screenshot: https://i.sstatic.net/IXjZG.jpg

CSS Code:

Section A {
    margin: 0px;
    padding: 0px;
    background-color: #FAFAFA;
    float: left;
    width: 75%;
}
Section B {
    float: right;
    width: 25%;
    text-align: left;
}
Footnote-sign {
    background-color: #ffc;
    cursor: pointer;
    vertical-align: super;
    font-size: 77%;
}
Footnote-tooltip {
    background-color: #fea; 
    border: 1px solid #6b0000; 
    display: inline; 
    padding: 5px; 
    display: none; 
    position: absolute;
    font-size: 85%;
    max-width: 540px;
    text-align: left;
}

Solution

  • You need to add a z-index to the footnote element to make it appear to be above every other element, without the HTML I will just apply the z-index to both footnote CSS elements

    CSS

    Footnote-sign {
        background-color: #ffc;
        cursor: pointer;
        vertical-align: super;
        font-size: 77%;
        z-index: 100; /* a large number to ensure it's on top */
    }
    Footnote-tooltip {
        background-color: #fea; 
        border: 1px solid #6b0000; 
        display: inline; 
        padding: 5px; 
        display: none; 
        position: absolute;
        font-size: 85%;
        max-width: 540px;
        text-align: left;
        z-index: 100; /* a large number to ensure it's on top */
    }