Javascript 如何将html文本放置在画布flot图表的顶部?
这是我的简单答案。我希望将HTML文本放在flot图表的顶部。或者将flot图表放在背景中(取决于您的想法) HTML: JS(其余内容请参见):Javascript 如何将html文本放置在画布flot图表的顶部?,javascript,jquery,css,z-index,flot,Javascript,Jquery,Css,Z Index,Flot,这是我的简单答案。我希望将HTML文本放在flot图表的顶部。或者将flot图表放在背景中(取决于您的想法) HTML: JS(其余内容请参见): 您可以将h1的位置设置为绝对位置 h1 { z-index:100; color:blue; font-size:5em; margin:0; line-height:0.9em; position:absolute;} 为我工作你应该添加职位:绝对到css中的h1 注意:z-index仅适用于定位元素(位置:绝对, 位置:相对,或位置:固定)
您可以将h1的位置设置为绝对位置
h1 { z-index:100; color:blue; font-size:5em; margin:0; line-height:0.9em; position:absolute;}
为我工作你应该添加
职位:绝对代码>到css中的h1
注意:z-index仅适用于定位元素(位置:绝对,
位置:相对,或位置:固定)
出于某种原因,将#占位符的z索引设置为-1对我来说很有用:POrposition:relative
可以在不定位的情况下利用z索引。
#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;
}
$(document).ready(function(){
chart = $.plot($("#placeholder"),data,options);
});
h1 { z-index:100; color:blue; font-size:5em; margin:0; line-height:0.9em; position:absolute;}
#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;
}