Skip to content
Justice Tech School

Attribute Selectors in Depth

Select by attribute presence, exact value or partial match: [href], [type="text"], [href^="https"] starts with, [href$=".pdf"] ends with and [class*="btn"] contains.

Example
<style>
a[href^="https"] { color: #5eead4 } a[href$=".pdf"] { color: #f59e0b }
</style>
<a href="https://x.com">Secure</a> <br><a href="doc.pdf">PDF</a>

Exercise

Starts with.

a[href="https"]

Quiz Test

Which means ends with?

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