How to place html text on top of a felt tip chart?

Here's my simple jsFiddle . I am looking to place HTML text on top of a fleet diagram. Or put the fleet map in the background (depending on how you think about it).

text on top of flot

HTML:

<div id="wrapper">
  <h1>Place me on top please. How?!</h1>
  <div id="placeholder"></div>
</div>

      

CSS

#wrapper { position:relative; }
h1 { z-index:100; color:blue; font-size:5em; margin:0; line-height:0.9em; }
#placeholder {
    width:500px;
    height:300px;
    position:absolute;
    top:0;
    left:0;
    z-index:1;
}

      

JS (see jsFiddle for the rest):

$(document).ready(function(){
    chart = $.plot($("#placeholder"),data,options);
});

      

+3


source to share


2 answers


You have to add position: absolute;

to h1 in your css ...

Note: z-index only works on positioned elements (position: absolute, position: relative, or position: fixed).

source of this quoted text



#wrapper { position:relative; }
h1 { z-index:100; color:blue; position: absolute; font-size:5em; margin:0; line-height:0.9em; }
#placeholder {
    width:500px;
    height:300px;
    position:absolute;
    top:0;
    left:0;
    z-index:1;
}

      

:: JSFIDDLE ::

+2


source


You can do h1 absolute value positioning

h1 { z-index:100; color:blue; font-size:5em; margin:0; line-height:0.9em; position:absolute;}

      



Worked for me

+2


source







All Articles