Tsallaka zuwa abun ciki
Justice Tech School

::first-line, ::first-letter and ::selection

::first-letter styles a drop cap, ::first-line the first line and ::selection the highlighted text. They need no extra HTML.

Example
<style>
p::first-letter { font-size: 2em; color: #f59e0b } p::first-line { color: #5eead4 } p::selection { background: #f59e0b; color: #000 }
</style>
<p>Select this text to see the highlight colour change.</p>

Exercise

Drop cap.

p::first-

Quiz Test

Which styles highlighted text?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.