<html> | |
<style> | |
#target | |
{ | |
border-color: green; | |
border-style: solid; | |
padding: 1em 1em; | |
} | |
#target::before | |
{ | |
content: "BEFORE"; | |
display: table-cell; | |
border-color: blue; | |
border-style: solid; | |
padding: 1em 1em; | |
} | |
</style> | |
<div id="target"> | |
<div id="span"> CONTENT</div> | |
</div> | |
<script> | |
document.body.offsetTop; | |
target.style.color = "red"; | |
</script> | |
</html> |