<!DOCTYPE html>
<meta charset="UTF-8">
<body>
<iframe
  id="iframe"
  srcdoc="
    <style>
      span {
        color: blue;
        background-color: cyan;
      }
    </style>
    <span id='span-iframe'>abc</span>
  "
  >
</iframe>