<!doctype html> | |
<style>p::first-letter { font-size: 500%; color: red; }</style> | |
<p> [!(5)#]9abcdefghi</p> | |
<script> | |
const selection = window.getSelection(); | |
const sample = document.querySelector('p'); | |
// Select "abc" | |
selection.collapse(sample.firstChild, 10); | |
selection.extend(sample.firstChild, 13); | |
</script> |