I have this html file where I want to overlay some text over another. I tried to use the z-index property but can’t get it to work. What is missing in my code?
thanks a lot
Here is the code
<html>
<head>
<style>
#overlay {
z-index:100;
}
</style>
</head>
<body>
<div id='overlay'>overlayed text</div>
This is some dummy text
</body>
</html>
You need to set
position: absolute. Thez-indexapplies to elements that aren’t statically positioned (see BoltClock’s comment).