<!DOCTYPE html>
<style>
div { color: red; }
div::first-line { color: green }
</style>
<div id="x"></div>
<script>
x.offsetWidth;
var span = document.createElement('span');
span.textContent = 'This should be green';
x.appendChild(span);
</script>