<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#test iframe {
border: none;
background: #333;
width: 500px;
height: 500px;
overflow: hidden;
}
#test iframe:before {
display: block;
content: " test";
width: 500px;
height: 500px;
background: url('overlay.png') no-repeat;
position: relative;
top: 0px;
left: 0px;
z-index: 999;
}
</style>
</head>
<body>
<div id="test">
<p><iframe></iframe></p>
</div>
</body>
</html>
I'm trying to place an image over an iframe
but for some reason the ::before
selector isn't getting along with the iframe
— try replacing the iframe
with any other element and it works. I need the iframe
to be a child of the p element.